[Clang][C] What is the type of a bit-field? (For generic selection / constexpr initialization) #101299
Labels
accepts-invalid
c23
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
confirmed
Verified by a second party
Uh oh!
There was an error while loading. Please reload this page.
Seen at #78112 (review), this compiles surprisingly in C23:
My reading of N3096:
§6.7.1p6:
§6.6p4:
§6.7.2.1p12:
... So the member
i
has a signed type with 8 bits, which 255 is not representable in, and Clang should reject the initializer.Two other places I can think of where the type of something is observed is
typeof
(which explicitly bans bit-fields), and_Generic
. Clang currently allows:which according to §6.7.2.1p12, it shouldn't? The bit-field type with width 8 should not be compatible with a 64 bit wide type. Unless the lvalue conversion done converts the bit-field type to long long, but that doesn't seem to be allowed by §6.3.2.1
CC @AaronBallman @Fznamznon
See also:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88731
DR#315
DR#481
The text was updated successfully, but these errors were encountered: