[Bug c++/55776] -Wshadow generates an incorrect warning with enum classes
jason at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 4 20:50:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55776
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
The warning seems correct to me; within the scope of myenum (i.e. in the
initializers of other enumerators) the foo enumerator shadows the global foo.
typedef int foo;
enum class myenum
{
foo,
bar = foo // finds myenum::foo
};
If the order of the typedef and the enum is reversed, there is no warning
because there is no shadowing; in that case, if the foo enumerator had a
different name, the reference in the initializer of bar would just be an error.
More information about the Gcc-bugs
mailing list