[PATCH] D131255: Fix Wbitfield-constant-conversion on 1-bit signed bitfield
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 5 07:13:39 PDT 2022
aaron.ballman added a comment.
In D131255#3702286 <https://reviews.llvm.org/D131255#3702286>, @ShawnZhong wrote:
> Thanks for the quick reply and the reference on the C standard!
> On the C++ side, Section C.1.8 specified that `int` bit-fields are signed:
>> Change: Bit-fields of type plain int are signed.
>> Rationale: Leaving the choice of signedness to implementations could lead to inconsistent definitions of template specializations. For consistency, the implementation freedom was eliminated for non-dependent types, too.
>> Effect on original feature: The choise is implementation-defined in C, but not so in C++.
Agreed; I think that's falling out from https://eel.is/c++draft/class.bit#4.sentence-1 and https://eel.is/c++draft/basic.fundamental#1.sentence-1.
> Implementation-wise, I'll see what I can find in CodeGen on whether `int` bit-fields are signed for C
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits