-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
fix Issue 21932 ImportC: enum ENUM conflicts with enum ENUM #12787
Conversation
Thanks for your pull request, @WalterBright! Bugzilla references
|
This is not a critical bug. Lowered to normal. |
Please fix the typo in the title and commit message. |
942f402
to
794ccbb
Compare
else | ||
{ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anything going to end up here? Otherwise just remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left that there just to point out that I had not forgotten about that case.
Just use the same logic as how what type an integer literal should be. Though I'm curious how it deals with both a signed and unsigned value as members. With 32-bit in, I assume it would go up to 64-bit long, but from there, would it pick 128-bit cent? Edit: Seems to be warn and overflow
|
Saying that, we do have
|
I thought I'd use the "common type" logic one gets with |
But that's a problem for a separate PR. |
Sure, so long as there's room to add support for ARM short enums afterwards, then it will be fine. |
assert(sd2); // only tags allowed in tag symbol table | ||
} | ||
} | ||
|
||
if (sd && sd2) // `s` is a tag, `sd2` is the same tag | ||
{ | ||
if (log) printf(" tag is already defined\n"); | ||
|
||
if (sd.kind() != sd2.kind()) // being enum/struct/union must match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, hidden string comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly, as D merges string duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only if they appear in the same compilation unit.
Fixing the bug meant revamping how enums were done:
Todo: enum base types are still
int
. Need to figure out just what gcc's wrongly documented rule is for determining the base type (it doesn't match gcc's behavior). The C11 spec is self-contradictory on this issue.