[Bug c++/55776] -Wshadow generates an incorrect warning with enum classes

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 5 00:15:00 GMT 2013


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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #3)
> But the global foo is a type while myenum::foo is not a type. Is there any
> context where they can be used interchangeably?
> 
> enum class myenum
> {
>   bar = int 
> };
> 
> doesn't make sense.

How about this:

typedef int foo;

enum class myenum
{
  foo = 1,
  bar = (foo)+1
};

What is the value of myenum::bar?  Is it clear and unambiguous, or should there
be a warning?


More information about the Gcc-bugs mailing list