public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48536] New: C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5
@ 2011-04-09 22:11 shaw.john.r at gmail dot com
  2011-05-03 20:00 ` [Bug c++/48536] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: shaw.john.r at gmail dot com @ 2011-04-09 22:11 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: C++0x Automatic Enumerator Incrementation is not
                    compliant with Clause 7.2/5
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: shaw.john.r@gmail.com


The enumerations defined below are well-formed C++0x, but g++, with C++0x
extensions enabled, still treats #1 as an overflow error.

Note: Comeau C/C++ 4.3.10.1 with C++0x extensions enabled reports no errors.

#include <climits>
//
// g++ version 4.5.2 and below
//
// Compiler options:
//    -std=c++0x
//    -std=gnu++0x
// non-compliant error message:
//    "error: overflow in enumeration values"
//
// According to C++ draft N1905 (2005) and above / Clause 7.2/5
// The following enumeration is well-formed.
//
enum Enum_Inc  { EI_1=UINT_MAX, EI_2 }; // #1

// The above should be equivalent to the following
enum Enum_Inc2 { FI_1=UINT_MAX, FI_2=FI_1+1 }; // #2


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

* [Bug c++/48536] C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5
  2011-04-09 22:11 [Bug c++/48536] New: C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5 shaw.john.r at gmail dot com
@ 2011-05-03 20:00 ` redi at gcc dot gnu.org
  2011-05-03 20:38 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-03 20:00 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-03 20:00:08 UTC ---
I'm not sure #1 is equivalent to #2, but I think they should both be
well-formed.
Jason, can you confirm?


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

* [Bug c++/48536] C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5
  2011-04-09 22:11 [Bug c++/48536] New: C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5 shaw.john.r at gmail dot com
  2011-05-03 20:00 ` [Bug c++/48536] " redi at gcc dot gnu.org
@ 2011-05-03 20:38 ` jason at gcc dot gnu.org
  2011-05-25 22:12 ` [Bug c++/48536] [C++0x] " jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-03 20:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.03 20:34:19
     Ever Confirmed|0                           |1

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-03 20:34:19 UTC ---
Agreed.

"Otherwise the type of the initializing value is the same as the type of the
initializing value of the preceding enumerator unless the incremented value is
not representable in that type, in which case the type is an unspecified
integral type sufficient to contain the incremented value. If no such type
exists, the program is ill-formed."

Instead of complaining about overflow, we should adjust the type of EI_2.

But I'm pretty sure #1 and #2 are not equivalent because the initializer for
FI_2 wraps to 0.


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

* [Bug c++/48536] [C++0x] Automatic Enumerator Incrementation is not compliant with Clause 7.2/5
  2011-04-09 22:11 [Bug c++/48536] New: C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5 shaw.john.r at gmail dot com
  2011-05-03 20:00 ` [Bug c++/48536] " redi at gcc dot gnu.org
  2011-05-03 20:38 ` jason at gcc dot gnu.org
@ 2011-05-25 22:12 ` jason at gcc dot gnu.org
  2011-05-26  3:07 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-25 22:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


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

* [Bug c++/48536] [C++0x] Automatic Enumerator Incrementation is not compliant with Clause 7.2/5
  2011-04-09 22:11 [Bug c++/48536] New: C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5 shaw.john.r at gmail dot com
                   ` (2 preceding siblings ...)
  2011-05-25 22:12 ` [Bug c++/48536] [C++0x] " jason at gcc dot gnu.org
@ 2011-05-26  3:07 ` jason at gcc dot gnu.org
  2011-05-26  3:09 ` jason at gcc dot gnu.org
  2011-09-28 18:31 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-26  3:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-26 02:23:04 UTC ---
Author: jason
Date: Thu May 26 02:23:02 2011
New Revision: 174258

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174258
Log:
    PR c++/48536
    * decl.c (build_enumerator): If incremented enumerator won't fit in
    previous integral type, find one it will fit in.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/enum17.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C


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

* [Bug c++/48536] [C++0x] Automatic Enumerator Incrementation is not compliant with Clause 7.2/5
  2011-04-09 22:11 [Bug c++/48536] New: C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5 shaw.john.r at gmail dot com
                   ` (3 preceding siblings ...)
  2011-05-26  3:07 ` jason at gcc dot gnu.org
@ 2011-05-26  3:09 ` jason at gcc dot gnu.org
  2011-09-28 18:31 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-26  3:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-26 03:08:22 UTC ---
Fixed for 4.7.


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

* [Bug c++/48536] [C++0x] Automatic Enumerator Incrementation is not compliant with Clause 7.2/5
  2011-04-09 22:11 [Bug c++/48536] New: C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5 shaw.john.r at gmail dot com
                   ` (4 preceding siblings ...)
  2011-05-26  3:09 ` jason at gcc dot gnu.org
@ 2011-09-28 18:31 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-28 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnetserrspam at gmail dot
                   |                            |com

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-28 18:25:47 UTC ---
*** Bug 50559 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2011-09-28 18:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-09 22:11 [Bug c++/48536] New: C++0x Automatic Enumerator Incrementation is not compliant with Clause 7.2/5 shaw.john.r at gmail dot com
2011-05-03 20:00 ` [Bug c++/48536] " redi at gcc dot gnu.org
2011-05-03 20:38 ` jason at gcc dot gnu.org
2011-05-25 22:12 ` [Bug c++/48536] [C++0x] " jason at gcc dot gnu.org
2011-05-26  3:07 ` jason at gcc dot gnu.org
2011-05-26  3:09 ` jason at gcc dot gnu.org
2011-09-28 18:31 ` redi at gcc dot gnu.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).