fix #10840 writeln() of bitfields#10851
Merged
WalterBright merged 1 commit intodlang:masterfrom Aug 27, 2025
Merged
Conversation
Contributor
|
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.
|
Member
Author
|
@ibuclaw please review and merge. |
ibuclaw
approved these changes
Aug 27, 2025
Comment on lines
+2552
to
+2555
| * 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(). |
Member
There was a problem hiding this comment.
FYI tracking this issue with staggered unions in #10844
| { | ||
| 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 ]) != |
Member
There was a problem hiding this comment.
I didn't realise getBitfieldOffset worked for non-bitfields.
Member
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Issue #10840
This fix is blocking dlang/dmd#21625