public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16603] New: Incorrect enumerator type before enumeration's closing brace
@ 2004-07-17  7:56 gccbugs at contacts dot eelis dot net
  2004-07-17  9:23 ` [Bug c++/16603] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: gccbugs at contacts dot eelis dot net @ 2004-07-17  7:56 UTC (permalink / raw)
  To: gcc-bugs

In 7.2 [dcl.enum] paragraph 4 the standard states

  "Prior to the closing brace, the type of each enumerator is the type of its
initializing value."

In the example below y is defined prior to the enum-specifier's closing brace,
where the type of x is the type of its initializing value, which in this case is
char. Therefore, I would think that the value of y should be sizeof(char).
However, when run the program displays the "hmm" message indicating that this is
not the case..

  char const c = 'q';

  enum
  {
    x = c,
    y = sizeof(x)
  };

  #include <iostream>

  int main ()
  {
    if (y != sizeof(char))
      std::cout << "hmm" << std::endl;
  }

-- 
           Summary: Incorrect enumerator type before enumeration's closing
                    brace
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gccbugs at contacts dot eelis dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/16603] Incorrect enumerator type before enumeration's closing brace
  2004-07-17  7:56 [Bug c++/16603] New: Incorrect enumerator type before enumeration's closing brace gccbugs at contacts dot eelis dot net
@ 2004-07-17  9:23 ` pinskia at gcc dot gnu dot org
  2004-07-17 18:02 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-17  9:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-17 09:23 -------
          value = decl_constant_value (value);

          if (TREE_CODE (value) == INTEGER_CST)
            {
              value = perform_integral_promotions (value); <-- bug here if there is a bug.
              constant_expression_warning (value);
            }

-- 


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


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

* [Bug c++/16603] Incorrect enumerator type before enumeration's closing brace
  2004-07-17  7:56 [Bug c++/16603] New: Incorrect enumerator type before enumeration's closing brace gccbugs at contacts dot eelis dot net
  2004-07-17  9:23 ` [Bug c++/16603] " pinskia at gcc dot gnu dot org
@ 2004-07-17 18:02 ` pinskia at gcc dot gnu dot org
  2004-07-19 13:23 ` bangerth at dealii dot org
  2005-01-17  0:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-17 18:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-17 18:02 -------
It seems like this has been a bug since before EGCS split, history becomes fuzzy before that.

-- 


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


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

* [Bug c++/16603] Incorrect enumerator type before enumeration's closing brace
  2004-07-17  7:56 [Bug c++/16603] New: Incorrect enumerator type before enumeration's closing brace gccbugs at contacts dot eelis dot net
  2004-07-17  9:23 ` [Bug c++/16603] " pinskia at gcc dot gnu dot org
  2004-07-17 18:02 ` pinskia at gcc dot gnu dot org
@ 2004-07-19 13:23 ` bangerth at dealii dot org
  2005-01-17  0:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-07-19 13:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-07-19 13:23 -------
Confirmed.  

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-19 13:23:37
               date|                            |


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


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

* [Bug c++/16603] Incorrect enumerator type before enumeration's closing brace
  2004-07-17  7:56 [Bug c++/16603] New: Incorrect enumerator type before enumeration's closing brace gccbugs at contacts dot eelis dot net
                   ` (2 preceding siblings ...)
  2004-07-19 13:23 ` bangerth at dealii dot org
@ 2005-01-17  0:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-17  0:34 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Last reconfirmed|2004-10-18 03:16:26         |2005-01-17 00:34:08
               date|                            |


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


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

* [Bug c++/16603] Incorrect enumerator type before enumeration's closing brace
       [not found] <bug-16603-4@http.gcc.gnu.org/bugzilla/>
  2012-01-01 20:03 ` paolo.carlini at oracle dot com
@ 2012-01-01 22:34 ` paolo.carlini at oracle dot com
  2012-01-01 22:34 ` paolo at gcc dot gnu.org
  2 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-01 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-01 22:34:20 UTC ---
Fixed for 4.7.0.


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

* [Bug c++/16603] Incorrect enumerator type before enumeration's closing brace
       [not found] <bug-16603-4@http.gcc.gnu.org/bugzilla/>
  2012-01-01 20:03 ` paolo.carlini at oracle dot com
  2012-01-01 22:34 ` paolo.carlini at oracle dot com
@ 2012-01-01 22:34 ` paolo at gcc dot gnu.org
  2 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-01-01 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-01-01 22:33:35 UTC ---
Author: paolo
Date: Sun Jan  1 22:33:31 2012
New Revision: 182776

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182776
Log:
/cp
2012-01-01  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/16603
    * decl.c (build_enumerator): Don't call perform_integral_promotions
    on the value.

/testsuite
2012-01-01  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/16603
    * g++.dg/parse/enum8.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/parse/enum8.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/16603] Incorrect enumerator type before enumeration's closing brace
       [not found] <bug-16603-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-01 20:03 ` paolo.carlini at oracle dot com
  2012-01-01 22:34 ` paolo.carlini at oracle dot com
  2012-01-01 22:34 ` paolo at gcc dot gnu.org
  2 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-01 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|gcc-bugs at gcc dot gnu.org |
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-01 20:03:11 UTC ---
On it.


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

end of thread, other threads:[~2012-01-01 22:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-17  7:56 [Bug c++/16603] New: Incorrect enumerator type before enumeration's closing brace gccbugs at contacts dot eelis dot net
2004-07-17  9:23 ` [Bug c++/16603] " pinskia at gcc dot gnu dot org
2004-07-17 18:02 ` pinskia at gcc dot gnu dot org
2004-07-19 13:23 ` bangerth at dealii dot org
2005-01-17  0:34 ` pinskia at gcc dot gnu dot org
     [not found] <bug-16603-4@http.gcc.gnu.org/bugzilla/>
2012-01-01 20:03 ` paolo.carlini at oracle dot com
2012-01-01 22:34 ` paolo.carlini at oracle dot com
2012-01-01 22:34 ` paolo 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).