This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/16186] New: gcc should have an option to warn about enumerations with duplicate values
- From: "austern at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jun 2004 22:39:43 -0000
- Subject: [Bug c/16186] New: gcc should have an option to warn about enumerations with duplicate values
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider the following enumeration declaration:
enum status { ok = 0, err = -1, foo, bar };
The enumerators 'ok' and 'foo' will have the same value. This may be what the programmer intended,
but it's more likely to be an oversight. The C and C++ front ends should have a warning (which
probably should not be enabled by default or with -Wall) for enumerations whose enumerators have
duplicate values, since duplicates are likely to be a sign of programmer error.
--
Summary: gcc should have an option to warn about enumerations
with duplicate values
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: austern at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: all
GCC host triplet: all
GCC target triplet: all
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16186