diff options
author | Juan M Gómez <info@jmgomez.me> | 2024-03-11 11:10:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-11 12:10:43 +0100 |
commit | 93399776c4640875c22c24e95bf8070dfd02d227 (patch) | |
tree | 054a2c959fd910d8c24b07439858b8c83f210ce4 /tests/cpp | |
parent | 94c599687796f4ee3872c8aa866827b9ed33f52b (diff) | |
download | Nim-93399776c4640875c22c24e95bf8070dfd02d227.tar.gz |
[C++] Allow `member` to define static funcs (#23387)
Diffstat (limited to 'tests/cpp')
-rw-r--r-- | tests/cpp/tmember.nim | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/cpp/tmember.nim b/tests/cpp/tmember.nim index 07bd5e0ee..1a5b6fd97 100644 --- a/tests/cpp/tmember.nim +++ b/tests/cpp/tmember.nim @@ -8,6 +8,8 @@ hello foo hello boo hello boo FunctorSupport! +static +static destructing destructing ''' @@ -34,7 +36,7 @@ echo doo == Doo(test: 1) #virtual proc newCpp*[T](): ptr T {.importcpp:"new '*0()".} type - Foo = object of RootObj + Foo {.exportc.} = object of RootObj FooPtr = ptr Foo Boo = object of Foo BooPtr = ptr Boo @@ -62,3 +64,12 @@ proc invoke(f: NimFunctor, n:int) {.member:"operator ()('2 #2)" .} = {.experimental: "callOperator".} proc `()`(f: NimFunctor, n:int) {.importcpp:"#(@)" .} NimFunctor()(1) + +#static +proc staticProc(self: FooPtr) {.member: "static $1()".} = + echo "static" + +proc importedStaticProc() {.importcpp:"Foo::staticProc()".} + +foo.staticProc() +importedStaticProc() |