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++/16603] New: Incorrect enumerator type before enumeration's closing brace


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


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