diff options
Diffstat (limited to 'tests/cpp')
-rw-r--r-- | tests/cpp/tstaticvar_via_typedesc.nim | 20 | ||||
-rw-r--r-- | tests/cpp/tthread_createthread.nim | 14 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/cpp/tstaticvar_via_typedesc.nim b/tests/cpp/tstaticvar_via_typedesc.nim new file mode 100644 index 000000000..7a9fa2afc --- /dev/null +++ b/tests/cpp/tstaticvar_via_typedesc.nim @@ -0,0 +1,20 @@ +discard """ + cmd: "nim cpp $file" + output: "42" +""" + +# bug #2324 + +static: assert defined(cpp), "compile in cpp mode" + +{.emit: """ +class Foo { +public: + static int x; +}; +int Foo::x = 42; +""".} + +type Foo {.importcpp:"Foo".} = object +proc x* (this: typedesc[Foo]): int {.importcpp:"Foo::x@", nodecl.} +echo Foo.x diff --git a/tests/cpp/tthread_createthread.nim b/tests/cpp/tthread_createthread.nim new file mode 100644 index 000000000..0dc081268 --- /dev/null +++ b/tests/cpp/tthread_createthread.nim @@ -0,0 +1,14 @@ +discard """ + cmd: "nim cpp --hints:on --threads:on $options $file" +""" + +proc threadMain(a: int) {.thread.} = + discard + +proc main() = + var thread: TThread[int] + + thread.createThread(threadMain, 0) + thread.joinThreads() + +main() \ No newline at end of file |