Code generation for generics broken by sighashes #5135

Closed
nigredo-tori opened this Issue Dec 21, 2016 · 0 comments

Projects

None yet

1 participant

@nigredo-tori
Contributor

This seems to be introduced by sighashes merge.

Reduced example:

a.nim:

proc fail*[E](e: E): void =
  raise newException(Exception, e)

b.nim:

import ./a

fail("foo")

This fails to compile with both C++ and C backends:

c:

Error: execution of an external compiler program 'gcc -c  -w  -I/home/dmitry/work/nim/lib -o /home/dmitry/work/tmp/nimcache/dups_a.o /home/dmitry/work/tmp/nimcache/dups_a.c' failed with exit code: 1

/home/dmitry/work/tmp/nimcache/dups_a.c: In function ‘fail_0QhIpWP3zzTrLZ6v79bJ7JQ’:
/home/dmitry/work/tmp/nimcache/dups_a.c:265:13: error: ‘e_uhuxcz3SrnDDeiM9a6DGotw’ redeclared as different kind of symbol
  Exception* e_uhuxcz3SrnDDeiM9a6DGotw;
             ^
/home/dmitry/work/tmp/nimcache/dups_a.c:264:62: note: previous definition of ‘e_uhuxcz3SrnDDeiM9a6DGotw’ was here
 N_NIMCALL(void, fail_0QhIpWP3zzTrLZ6v79bJ7JQ)(NimStringDesc* e_uhuxcz3SrnDDeiM9a6DGotw) {
                                                              ^

cpp:

Error: execution of an external compiler program 'g++ -c  -w -w -fpermissive  -I/home/dmitry/work/nim/lib -o /home/dmitry/work/tmp/nimcache/dups_a.o /home/dmitry/work/tmp/nimcache/dups_a.cpp' failed with exit code: 1

/home/dmitry/work/tmp/nimcache/dups_a.cpp: In function ‘void fail_0QhIpWP3zzTrLZ6v79bJ7JQ(NimStringDesc*)’:
/home/dmitry/work/tmp/nimcache/dups_a.cpp:260:13: error: declaration of ‘Exception* e_uhuxcz3SrnDDeiM9a6DGotw’ shadows a parameter
  Exception* e_uhuxcz3SrnDDeiM9a6DGotw;
             ^
/home/dmitry/work/tmp/nimcache/dups_a.cpp:269:125: error: cannot convert ‘Exception*’ to ‘NimStringDesc*’ for argument ‘1’ to ‘NimStringDesc* copyStringRC1(NimStringDesc*)’
  LOC1 = (*e_uhuxcz3SrnDDeiM9a6DGotw).message; (*e_uhuxcz3SrnDDeiM9a6DGotw).message = copyStringRC1(e_uhuxcz3SrnDDeiM9a6DGotw);
                                                                                                                             ^

checked for c166394
bisect points to 71a23fb

@Araq Araq added a commit that closed this issue Dec 21, 2016
@Araq Araq fixes #5135 06a8d37
@Araq Araq closed this in 06a8d37 Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment