// RUN: %clang_cc1 -fsyntax-only -verify %s struct A0 { struct K { }; }; template struct B0: A0 { static void f() { K k; } }; namespace E1 { typedef double A; template class B { typedef int A; }; template struct X : B { A* blarg(double *dp) { return dp; } }; } namespace E2 { struct A { struct B; int *a; int Y; }; int a; template struct Y : T { struct B { /* ... */ }; B b; void f(int i) { a = i; } Y* p; }; Y ya; } namespace PR14402 { template struct A { typedef int n; int f(); struct B {}; struct C : B { // OK, can't be sure whether we derive from A yet. using A::n; int g() { return f(); } }; struct D { using A::n; // expected-error {{using declaration refers into 'A::', which is not a base class of 'D'}} int g() { return f(); } // expected-error {{call to non-static member function 'f' of 'A' from nested type 'D'}} }; struct E { char &f(); }; struct F : E { // FIXME: Reject this prior to instantiation; f() is known to return int. char &g() { return f(); } // expected-error@-1 {{'PR14402::A::f' is not a member of class 'PR14402::A::F'}} // expected-error@-2 {{non-const lvalue reference to type 'char' cannot bind to a temporary of type 'int'}} }; }; template<> struct A::B : A {}; A::C::n n = A::C().g(); // 'not a member' char &r = A::F().g(); // expected-note {{in instantiation of}} template<> struct A::E : A {}; // 'cannot bind to a temporary' char &s = A::F().g(); // expected-note {{in instantiation of}} struct X; struct X { void f(); }; struct X; template struct Y : X { void g() { X::f(); } }; }