-
-
Notifications
You must be signed in to change notification settings - Fork 746
fix #10840 writeln() of bitfields #10851
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
Conversation
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
@ibuclaw please review and merge. |
* However, the overlap | ||
* check in general does not take into account staggered unions. | ||
* This can be fixed using the correct algorithm implemented in | ||
* the compiler function dmd.declaration.isOverlappedWith(). |
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.
FYI tracking this issue with staggered unions in #10844
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.
good!
{ | ||
static if (i == T.tupleof.length - 1 || T.tupleof[i].offsetof != T.tupleof[i+1].offsetof) | ||
static if (i == T.tupleof.length - 1 || | ||
T.tupleof[i ].offsetof * 8 + __traits(getBitfieldOffset,T.tupleof[i ]) != |
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 didn't realise getBitfieldOffset
worked for non-bitfields.
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 implemented it that way for exactly this reason! It greatly simplifies the overlap logic. You'll see the same thing in the dmd source code, as referenced.
Fixes Issue #10840
This fix is blocking dlang/dmd#21625