mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 17:34:43 +00:00
A faulty proc declaration is generated: N_NIMCALL(System::Input*, SystemManager::getSubsystem<'*0>())(void); The manual has been edited to add a nodecl pragma, which alleviates the issue Fix a typo in the vector_iterator example from the previous commit.
23 lines
375 B
Nim
23 lines
375 B
Nim
discard """
|
|
cmd: "nim cpp $file"
|
|
"""
|
|
|
|
{.emit: """
|
|
|
|
namespace System {
|
|
struct Input {};
|
|
}
|
|
|
|
struct SystemManager {
|
|
template <class T>
|
|
static T* getSubsystem() { return new T; }
|
|
};
|
|
|
|
""".}
|
|
|
|
type Input {.importcpp: "System::Input".} = object
|
|
proc getSubsystem*[T](): ptr T {.importcpp: "SystemManager::getSubsystem<'*0>()".}
|
|
|
|
let input: ptr Input = getSubsystem[Input]()
|
|
|