// RUN: %clang_cc1 -fsyntax-only -verify %s // PR4364 template struct a { // expected-note {{here}} T b() { return typename T::x(); } }; struct B { typedef B x; }; B c() { a x; return x.b(); } // Some extra tests for invalid cases template struct test2 { T b() { return typename T::a; } }; // expected-error{{expected '(' for function-style cast or type construction}} template struct test3 { T b() { return typename a; } }; // expected-error{{expected a qualified name after 'typename'}} template struct test4 { T b() { return typename ::a; } }; // expected-error{{refers to non-type member}} expected-error{{expected '(' for function-style cast or type construction}} // PR12884 namespace PR12884_original { template struct A { struct B { template struct X {}; typedef int arg; }; struct C { typedef B::X x; // expected-error {{missing 'typename'}} }; }; template <> struct A::B { template struct X {}; static const int arg = 0; }; A::C::x a; } namespace PR12884_half_fixed { template struct A { struct B { template struct X {}; typedef int arg; }; struct C { typedef typename B::X x; // expected-error {{use 'template'}} expected-error {{refers to non-type}} }; }; template <> struct A::B { template struct X {}; static const int arg = 0; // expected-note {{here}} }; A::C::x a; // expected-note {{here}} } namespace PR12884_fixed { template struct A { struct B { template struct X {}; typedef int arg; }; struct C { typedef typename B::template X x; }; }; template <> struct A::B { template struct X {}; static const int arg = 0; }; A::C::x a; // ok }