[Bug c++/37816] New: [c++0x] Invalid handling of scoped enums defined at class scope
piotr dot rak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Oct 13 11:26:00 GMT 2008
Code below presents behavior which I think is incorrect:
class A
{
enum class Color { Red, Orange, Yellow, Green, Blue, Violet };
enum class Alert { Green, Yellow, Red };
};
$ g++-4.4.0-alpha20081010 -c -std=c++0x /tmp/enum_class.cc
/tmp/enum_class.cc:4: error: declaration of ÂGreenÂ
/tmp/enum_class.cc:3: error: conflicts with previous declaration ÂA::Color
A::GreenÂ
/tmp/enum_class.cc:4: error: declaration of ÂYellowÂ
/tmp/enum_class.cc:3: error: conflicts with previous declaration ÂA::Color
A::YellowÂ
/tmp/enum_class.cc:4: error: declaration of ÂRedÂ
/tmp/enum_class.cc:3: error: conflicts with previous declaration ÂA::Color
A::RedÂ
Moreover, code:
class A
{
enum class Color { Red, Orange, Yellow, Green, Blue, Violet };
static const Color x = Red;
};
is incorrectly accepted.
This behavior is consistent in both versions i have checked, namely
gcc-g++-20080912 and gcc-g++-20081010.
--
Summary: [c++0x] Invalid handling of scoped enums defined at
class scope
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: piotr dot rak at gmail dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37816
More information about the Gcc-bugs
mailing list