blob: f3a60679d17604f8cdfdf3e3896cbb1fc4fcec12 [file] [log] [blame]
Anders Carlsson1f240322009-12-22 05:24:09 +00001// 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) {
John McCall7c2342d2010-03-10 11:27:22 +000019 Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<S<void *> >::push_back' requested here}}
Anders Carlsson1f240322009-12-22 05:24:09 +000020 }
21};
22
23class RetainReleaseChecker { };
24
25void f(GRExprEngine& Eng) {
John McCall7c2342d2010-03-10 11:27:22 +000026 Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<RetainReleaseChecker>' requested here}}
Anders Carlsson1f240322009-12-22 05:24:09 +000027}
John McCallc2233c52010-01-15 08:34:02 +000028
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() {
John McCall7c2342d2010-03-10 11:27:22 +000046 a = 0; // expected-error {{type 'test1::O' is not a direct or virtual base of ''B<int>''}}
John McCallc2233c52010-01-15 08:34:02 +000047 }
48 };
49 };
50 template struct O::B<int>; // expected-note {{in instantiation}}
51}