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]
Other format: [Raw text]

[Bug c/16186] New: gcc should have an option to warn about enumerations with duplicate values


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


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