This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/30260] Enumeration types and enumeration constants erroneously given unsigned types
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Dec 2006 21:22:33 -0000
- Subject: [Bug c/30260] Enumeration types and enumeration constants erroneously given unsigned types
- References: <bug-30260-13661@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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