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



             Bug #: 55776

           Summary: -Wshadow generates an incorrect warning with enum

                    classes

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: s...@s-e-f-i.de





In C++11 mode, enum classes can generate incorrect -Wshadow warnings:



g++ -Wshadow -std=c++11 test.cpp



typedef int foo;



enum class myenum

{

        foo

};



test.cpp:5:2: warning: declaration of 'foo' shadows a global declaration

[-Wshadow]

test.cpp:1:13: warning: shadowed declaration is here [-Wshadow]





Note, that if the typedef and the definition of the enum class are reversed, no

warning is produced.

Reply via email to