-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Unnamed bit field is being compared in defaulted equality operator #61335
Comments
@llvm/issue-subscribers-clang-codegen |
This does look like a bug, let me think a bit more before confirming. |
I agree this is a bug, we should not be including this in the comparison. I was wondering if because class.bit p2 says:
That perhaps clang is assuming some sort of zero init and therefore since it could not change then it would be fair to include them in the comparison but looking at the code I don't see this. My first take on fixing this would be to modify if (Field->isUnnamedBitfield())
continue; My initial test seems to indicate this does the job but I may be missing something. CC @zygoloid @AaronBallman |
Based on my reading of: https://eel.is/c++draft/class.compare.default#5.sentence-1 I believe you're correct on the approach for the fix, as well. |
We have another bug that looks like it is fixed by my proposed fix for this, so I am going to run |
@llvm/issue-subscribers-clang-frontend |
…o compare unnamed bit-fields If we look at class.bit p2 it tells us that that unnamed bit-fields are not members and class.compare.default p5 tells us that we should only compare non-static data members of the class. This fixes: llvm#61335 and llvm#61417 Differential Revision: https://reviews.llvm.org/D146329
…o compare unnamed bit-fields If we look at class.bit p2 it tells us that that unnamed bit-fields are not members and class.compare.default p5 tells us that we should only compare non-static data members of the class. This fixes: llvm/llvm-project#61335 and llvm/llvm-project#61417 Differential Revision: https://reviews.llvm.org/D146329
Demo: https://godbolt.org/z/75ee78Gss
Unnamed bit fields aren't members, so they shouldn't be compared.
The text was updated successfully, but these errors were encountered: