[Bug c/30260] Enumeration types and enumeration constants erroneously given unsigned types

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Tue Dec 19 21:22:00 GMT 2006



------- Comment #2 from joseph at codesourcery dot com  2006-12-19 21:22 -------
Subject: Re:  Enumeration types and enumeration constants
 erroneously given unsigned types

On Tue, 19 Dec 2006, pinskia at gcc dot gnu dot org wrote:

> So the error with -pedantic is correct as 0U - 1 is not representable as an
> int.

Read the testcase in the bug.  It doesn't use 0U - 1, it uses B1 - 1.  B1 
is an enumeration constant and so should have type int, regardless of the 
type of the expression used to set its value.  As such, the code is 
conforming and there is a GCC bug here.

There should be no diagnostic here, whether or not -pedantic is used, and 
there should be no dependence on -ansi or -pedantic for this testcase.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30260



More information about the Gcc-bugs mailing list