instantiate-member-expr.cpp revision 7c2342dd4c9947806842e5aca3d2bb2e542853c9
1// RUN: %clang_cc1 -fsyntax-only -verify %s 2template<typename T> 3struct S { 4 S() { } 5}; 6 7template<typename T> 8struct vector { 9 void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array size is negative}} 10}; 11 12class GRExprEngine { 13public: 14 typedef vector<S<void *> >CheckersOrdered; 15 CheckersOrdered Checkers; 16 17 template <typename CHECKER> 18 void registerCheck(CHECKER *check) { 19 Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<S<void *> >::push_back' requested here}} 20 } 21}; 22 23class RetainReleaseChecker { }; 24 25void f(GRExprEngine& Eng) { 26 Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<RetainReleaseChecker>' requested here}} 27} 28 29// PR 5838 30namespace test1 { 31 template<typename T> struct A { 32 int a; 33 }; 34 35 template<typename T> struct B : A<float>, A<T> { 36 void f() { 37 a = 0; // should not be ambiguous 38 } 39 }; 40 template struct B<int>; 41 42 struct O { 43 int a; 44 template<typename T> struct B : A<T> { 45 void f() { 46 a = 0; // expected-error {{type 'test1::O' is not a direct or virtual base of ''B<int>''}} 47 } 48 }; 49 }; 50 template struct O::B<int>; // expected-note {{in instantiation}} 51} 52