-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
GCC Error: redefinition of struct #13717
Comments
@Wh1teDuke this bug is not actionable, please provide a minimized reproducing example. Yes, this can take some efforts sometimes, but it's the only way, until #8276 is fixed |
Sadly I can't do that. I don't remember why but some code change made the bug disappear. I always try to isolate the code, but this time I had no success. Don't know what really triggered it. Sorry I cannot be of any help. |
Closing for now, there is also a better name mangler in the works that could fix it. |
Well, unfortunately I stumbled across this bug again, but this time I managed to reduce the code: # M1.nim ------------------
type Bar* = object
# M2.nim ------------------
import M1
import std/sets
var foo: HashSet[Bar]
# M3.nim ------------------
import M1, M2
type Type1[P] = P
type Type2 = ptr[Type1[Bar]]
.cache/nim/M3_d/stdlib_sets.nim.c:74:8: error: redefinition of ‘struct tyObject_Bar__Wcc5gWFgEqZSm9aH8GC9aOyg’
74 | struct tyObject_Bar__Wcc5gWFgEqZSm9aH8GC9aOyg {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.cache/nim/M3_d/stdlib_sets.nim.c:54:8: note: originally defined here
54 | struct tyObject_Bar__Wcc5gWFgEqZSm9aH8GC9aOyg {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.cache/nim/M3_d/stdlib_sets.nim.c:85:8: error: redefinition of ‘struct tySequence__3Z4QiwjOXcnT0SN6DgMBqg’
85 | struct tySequence__3Z4QiwjOXcnT0SN6DgMBqg {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.cache/nim/M3_d/stdlib_sets.nim.c:81:8: note: originally defined here
81 | struct tySequence__3Z4QiwjOXcnT0SN6DgMBqg {
| |
thanks; @Wh1teDuke if you want to help fix this issue, one way to do that would be to further reduce by removing external module dependency (std/sets) |
# M1.nim -------------------------
type TypeM1* = object
# M2.nim -------------------------
import M1
var v: seq[ptr[seq[TypeM1]]] # No Error -> var v: seq[ptr[TypeM1]]
# M3.nim -------------------------
import M1, M2
type TypeM3[P] = P
var v: TypeM3[TypeM1] I tried different combinations of generics/imports, so far this is the smallest combination. |
The question is, is |
It's valid code. |
Test
nim c M3
Error
The text was updated successfully, but these errors were encountered: