This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: g++ 2.96 -W issues bogus warning for conditional expression with enum and unsigned


> Is there a language lawyer in the house?

I think I can cite one. Core Issue 172, submitted by a guy named
Bjarne Stroustrup, starts

# According to 7.2 dcl.enum paragraph 5, the underlying type of an
# enum is an unspecified integral type, which could potentially be
# unsigned int. The promotion rules in 4.5 conv.prom paragraph 2 say
# that such an enumeration value used in an expression will be
# promoted to unsigned int.

He then proposes than unsigned int should be allowed as underlying
type only when int cannot represent all values, see
http://www.informatik.hu-berlin.de/~loewis/cwg_active.html#172

This would outlaw gcc's current implementation. The issue is still
open, and I'd expect intervention from various vendors (including gcc)
against this specific resolution.

On your original question: It seems you are right; this is a bug in
gcc.

Regards,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]