This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/32066] member/type lookup doesn't work properly with templates



------- Comment #3 from christian dot bruel at st dot com  2009-12-07 16:41 -------
> 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
> }
> 

OK. note that with the original tests, 'int X' was declared static.
That makes the case a little bit different since 3.3.7.2 refers to "object,
function or enumerator", not class member. 

So variants of this case have declarations:

struct A {
  struct X { };
  enum x {a, b, c} X;
};

and 

struct A {
  struct X { };
  void X();
};


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]