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; 2+ 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] 2+ messages in thread

* [Bug c/16186] gcc should have an option to warn about enumerations with duplicate values
  2004-06-24 23:09 [Bug c/16186] New: gcc should have an option to warn about enumerations with duplicate values austern at apple dot com
@ 2004-06-29  2:56 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-29  2:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-29 02:47 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-29 02:47:43
               date|                            |


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


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

end of thread, other threads:[~2004-06-29  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-24 23:09 [Bug c/16186] New: gcc should have an option to warn about enumerations with duplicate values 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).