This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16603] New: Incorrect enumerator type before enumeration's closing brace
- From: "gccbugs at contacts dot eelis dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jul 2004 07:56:42 -0000
- Subject: [Bug c++/16603] New: Incorrect enumerator type before enumeration's closing brace
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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