You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tuple struct is generated before the emitted class resulting in a compile error from the C++ compiler.
Example
{.emit: """ /*INCLUDESECTION*/#include <stdio.h>""".}
{.emit: """ /*TYPESECTION*/class C {public: C(); ~C(); void whatever() { puts("whatever"); };};""".}
type
C* {.importcpp:"C".} =objectprocmakeC():ptr C {.importcpp: "new C()".}
procwhatever(c:ptr C){.importcpp: "#.whatever()"}
proccTuple():(ptr C, ptr C) =result= (makeC(),makeC())
let (c1,c2) =cTuple()
c1.whatever()
c2.whatever()
Current Output
....CC: classtuple.nim
/home/deech/.cache/nim/classtuple_d/@mclasstuple.nim.cpp:44:1: error: ‘C’ does not name a type
44 | C* Field0;
| ^
/home/deech/.cache/nim/classtuple_d/@mclasstuple.nim.cpp:45:1: error: ‘C’ does not name a type
45 | C* Field1;
| ^
/home/deech/Nim/interop/classtuple.nim: In function ‘tyTuple__4K8uZbmB6yl2t1XJqL11Qg cTuple__oTOQqabzGbHm6A9agZwqIQw()’:
/home/deech/Nim/interop/classtuple.nim:20:9: error: ‘struct tyTuple__4K8uZbmB6yl2t1XJqL11Qg’ has no member named ‘Field0’
20 | result = (makeC(),makeC())
| ^~~~~~
compilation terminated due to -fmax-errors=3.
Expected Output
Successful compilation
Possible Solution
The generated output shows the tuple struct is declared ahead of the class declaration causing the problem.
$ nim -v
Nim Compiler Version 1.3.5 [Linux: amd64]
Compiled at 2020-08-28
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: 13e659cfec83eb3c2c3c2bbbf10d01ba59bc0d5b
active boot switches: -d:release
The text was updated successfully, but these errors were encountered:
Tuple struct is generated before the emitted class resulting in a compile error from the C++ compiler.
Example
Current Output
Expected Output
Successful compilation
Possible Solution
The generated output shows the tuple struct is declared ahead of the class declaration causing the problem.
The text was updated successfully, but these errors were encountered: