------- Comment #2 from redi at gcc dot gnu dot org 2009-12-07 15:11 ------- (In reply to comment #1) > I'm wondering if this is not an application of the name hiding rule described > in the IEC 14882:1998 (3.3.7) that says here that the class name T::X is > hidden > by the object static int T::X i, so T::X y refers to the object's name not the > class.
Exactly. The point is that the standard says "The usual qualified name lookup (3.4.3) is used to find the qualified-id even in the presence of typename." > Making the test invalid. Not certain, just a thought. The test is supposed to be invalid, but should give an error on line 6 and line 7, GCC only gives an error on line 7. > This could be reduced as ... Your reduced version is irrelevant because it's not a template and there's no "typename" keyword. GCC gets that right, but doesn't get the original report right. The test can be reduced to this, which should not compile: struct A { struct X { }; int X; }; template<class T> void f(T t) { typename T::X x; } void foo() { A a; f(a); // error: T::X refers to the data member A::X not the struct A::X } -- redi at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |accepts-invalid Known to fail| |4.1.2 4.4.2 Last reconfirmed|0000-00-00 00:00:00 |2009-12-07 15:11:25 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32066