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
It seems that when you define a type with different fields in two different scopes, and instantiate it in both scopes, and accedss a field in the second defintion, that didnt exist in the first definition, the generated c-code will be invalid.
[I] felix@rzbl ~/tmp> nim c nimbug.nim
Hint: used config file '/home/felix/git/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/felix/git/Nim/config/config.nims' [Conf]
....
CC: stdlib_assertions.nim
CC: stdlib_dollars.nim
CC: stdlib_formatfloat.nim
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: nimbug.nim
/home/felix/.cache/nim/nimbug_d/@mnimbug.nim.c: In function ‘NimMainModule’:
/home/felix/.cache/nim/nimbug_d/@mnimbug.nim.c:191:30: error: ‘tyObject_FoocolonObjectType___fGcm43VB58lQvE79caF19bjQ’ {aka ‘struct tyObject_FoocolonObjectType___fGcm43VB58lQvE79caF19bjQ’} has no member named ‘field’ 191 | T5_[0] = nimIntToStr((*T6_).field);
| ^
Error: execution of an external compiler program 'gcc -c -w -fmax-errors=3 -I/home/felix/git/Nim/lib -I/home/felix/tmp -o /home/felix/.cache/nim/nimbug_d/@mnimbug.nim.c.o /home/felix/.cache/nim/nimbug_d/@mnimbug.nim.c' failed with exit code: 1
Also:
[I] felix@rzbl ~/tmp> nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-04-04
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 97764c8dc91081875f57029ae3f72d3a503f5e45
active boot switches: -d:release
The text was updated successfully, but these errors were encountered:
It seems that when you define a type with different fields in two different scopes, and instantiate it in both scopes, and accedss a field in the second defintion, that didnt exist in the first definition, the generated c-code will be invalid.
Compiling this:
will result in:
Also:
The text was updated successfully, but these errors were encountered: