This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32066] member/type lookup doesn't work properly with templates
- From: "christian dot bruel at st dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Dec 2009 16:41:06 -0000
- Subject: [Bug c++/32066] member/type lookup doesn't work properly with templates
- References: <bug-32066-10252@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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