How to use _Generic with bit-fields

Joseph Myers joseph@codesourcery.com
Mon Feb 22 21:47:00 GMT 2016


I wonder if ISO C really ought to have a new Constraint "The controlling 
expression of a generic selection shall not be an expression that 
designates a bit-field member." (so requiring a diagnostic), much like 
such expressions being disallowed in sizeof, to reflect the special nature 
of bit-fields and their types in C.  Or, more weakly, to allow the cbrt 
example, "If the controlling expression of a generic selection is an 
expression that designates a bit-field member, it is unspecified whether 
the type of that expression is considered compatible with any integer 
types named in its generic association list.".

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc mailing list