public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/16186] New: gcc should have an option to warn about enumerations with duplicate values
@ 2004-06-24 23:09 austern at apple dot com
  2004-06-29  2:56 ` [Bug c/16186] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 8+ messages in thread
From: austern at apple dot com @ 2004-06-24 23:09 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-13 13:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-16186-4@http.gcc.gnu.org/bugzilla/>
2022-10-24 15:25 ` [Bug c/16186] gcc should have an option to warn about enumerations with duplicate values pinskia at gcc dot gnu.org
2022-10-24 18:37 ` mpolacek at gcc dot gnu.org
2022-10-24 18:43 ` marxin at gcc dot gnu.org
2022-10-24 18:48 ` mpolacek at gcc dot gnu.org
2022-10-24 19:18 ` marxin at gcc dot gnu.org
2023-03-10 20:12 ` trashyankes at wp dot pl
2023-03-13 13:44 ` jakub at gcc dot gnu.org
2004-06-24 23:09 [Bug c/16186] New: " austern at apple dot com
2004-06-29  2:56 ` [Bug c/16186] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).