Anders Carlsson | 1f24032 | 2009-12-22 05:24:09 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | template<typename T> |
| 3 | struct S { |
| 4 | S() { } |
| 5 | }; |
| 6 | |
| 7 | template<typename T> |
| 8 | struct vector { |
| 9 | void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array size is negative}} |
| 10 | }; |
| 11 | |
| 12 | class GRExprEngine { |
| 13 | public: |
| 14 | typedef vector<S<void *> >CheckersOrdered; |
| 15 | CheckersOrdered Checkers; |
| 16 | |
| 17 | template <typename CHECKER> |
| 18 | void registerCheck(CHECKER *check) { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame^] | 19 | Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<S<void *> >::push_back' requested here}} |
Anders Carlsson | 1f24032 | 2009-12-22 05:24:09 +0000 | [diff] [blame] | 20 | } |
| 21 | }; |
| 22 | |
| 23 | class RetainReleaseChecker { }; |
| 24 | |
| 25 | void f(GRExprEngine& Eng) { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame^] | 26 | Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<RetainReleaseChecker>' requested here}} |
Anders Carlsson | 1f24032 | 2009-12-22 05:24:09 +0000 | [diff] [blame] | 27 | } |
John McCall | c2233c5 | 2010-01-15 08:34:02 +0000 | [diff] [blame] | 28 | |
| 29 | // PR 5838 |
| 30 | namespace 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() { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame^] | 46 | a = 0; // expected-error {{type 'test1::O' is not a direct or virtual base of ''B<int>''}} |
John McCall | c2233c5 | 2010-01-15 08:34:02 +0000 | [diff] [blame] | 47 | } |
| 48 | }; |
| 49 | }; |
| 50 | template struct O::B<int>; // expected-note {{in instantiation}} |
| 51 | } |