This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: underlying type for enums
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 2 Dec 2003 09:21:03 +0000 (UTC)
- Subject: Re: underlying type for enums
- References: <20031202090652.GC32317@redhat.com>
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