underlying type for enums

Joseph S. Myers jsm@polyomino.org.uk
Tue Dec 2 09:45:00 GMT 2003


On Tue, 2 Dec 2003, Richard Henderson wrote:

> The easiest way to handle the enum bitfield thing, it would seem,
> would be to take the extended integer type route and follow the
> lead of C++ and define a type with the minimal TYPE_PRECISION
> for the enumerator values.  This brings up a number of issues:

There's also the strange code in c_common_signed_or_unsigned_type checking
modes rather than precisions with a comment referring to how C++ does
this.  Getting proper diagnostics for overflow of bit-field types requires
changes to this (for now I'm keeping the existing behaviour for enum
types).

>     This is almost certainly technically wrong, since to my reading
>     compatible enumerators must have the exact same values.  Also, 

AFAICT compatible enumerators must be the exactly same type, not just have 
the same values; there's no indication that compatibility (with the same 
integer type) is transitive here; PR 6024.

-- 
Joseph S. Myers
jsm@polyomino.org.uk



More information about the Gcc mailing list