parent
a541be8935
commit
36acac3000
2 changed files with 24 additions and 1 deletions
20
tests/cpp/tstaticvar_via_typedesc.nim
Normal file
20
tests/cpp/tstaticvar_via_typedesc.nim
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue