https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85128
--- Comment #5 from Steffen Nurpmeso <steffen at sdaoden dot eu> --- Sorry for not providing a test case. The C++ standard is clear here about this case too. I have a PDF version of a 2014 draft, and i would not see that in case your words are implying that gcc is right? In 7.1.3, The typedef specifier, i read Within the scope of its declaration, a typedef-name is syntactically equivalent to a keyword... So, in item 5, In a given class scope, a typedef specifier can be used to redefine any class-name declared in that scope that is not also a typedef-name to refer to the type to which it already refers. The example is struct S { typedef struct A { } A; // Ok typedef struct B B; // Ok typedef A A; // Ok }; This does not apply since the yet existing AutoToolbox is from an outer scope, and not a typedef by itself. In item 7, In a given scope, a typedef specifier shall not be used to redefine the name of any type declared in that scope to refer to a different type. Does not apply since we have different scopes. Item 8 Similarly, in a given scope, a class or enumeration shall not be declared with the same name as a typedef-name that is declared in that scope and refers to a type other than the class or enumeration itself. Does not apply thus. But we have 9.2, Class members: Nested types are classes (9.1, 9.7) and enumerations (7.2) defined in the class, and arbitrary types declared as members by use of a typedef declaration (7.1.3) What do you say?