Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat compl as a c++ keyword #6836

Closed
RedBeard0531 opened this issue Nov 29, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@RedBeard0531
Copy link
Contributor

commented Nov 29, 2017

proc f(compl: int): int = compl
echo f(1)
> nim cpp -r test.nim
Hint: used config file '/home/mstearn/.choosenim/toolchains/nim-0.17.2/config/nim.cfg' [Conf]
Hint: used config file '/home/mstearn/nim/tmp/nim.cfg' [Conf]
Hint: system [Processing]
Hint: test [Processing]
CC: test
CC: stdlib_system
CC: stdlib_sharedlist
CC: stdlib_locks
Error: execution of an external compiler program 'g++ -c  -w -w -fpermissive -pthread  -I/home/mstearn/.choosenim/toolchains/nim-0.17.2/lib -o /home/mstearn/nim/tmp/nimcache/test.o /home/mstearn/nim/tmp/nimcache/test.cpp' failed with exit code: 1

/home/mstearn/nim/tmp/nimcache/test.cpp:33:44: error: expected ‘)’ before ‘compl’ token
 N_NIMCALL(NI, f_EcL3gFSZtKQ77HxVBawzJA)(NI compl);
                                            ^~~~~
/home/mstearn/nim/tmp/nimcache/test.cpp:33:44: error: expected initializer before ‘compl’ token
/home/mstearn/nim/tmp/nimcache/test.cpp:77:44: error: expected ‘)’ before ‘compl’ token
 N_NIMCALL(NI, f_EcL3gFSZtKQ77HxVBawzJA)(NI compl) {
                                            ^~~~~
/home/mstearn/nim/tmp/nimcache/test.cpp:77:44: error: expected initializer before ‘compl’ token
/home/mstearn/nim/tmp/nimcache/test.cpp: In function ‘void NimMainModule()’:
/home/mstearn/nim/tmp/nimcache/test.cpp:136:8: error: ‘f_EcL3gFSZtKQ77HxVBawzJA’ was not declared in this scope
  T1_ = f_EcL3gFSZtKQ77HxVBawzJA(((NI) 1));
        ^~~~~~~~~~~~~~~~~~~~~~~~

It is one of the alternative operators. This bit me when trying to compile this real-world code: https://github.com/zielmicha/reactor.nim/blob/c3da1da3a0baab56374bfe938d4c5ef4819c2c9a/reactor/async/future.nim#L198

You can find a list of current and proposed keywords at http://en.cppreference.com/w/cpp/keyword. This includes the fun "contextual keywords" like final and override.

nc-x added a commit to nc-x/Nim that referenced this issue Oct 31, 2018

nc-x added a commit to nc-x/Nim that referenced this issue Nov 1, 2018

@Araq Araq closed this in dbfc5c5 Nov 1, 2018

nc-x added a commit to nc-x/Nim that referenced this issue Nov 2, 2018

Araq added a commit that referenced this issue Nov 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.