blob: bad72b5d676628b14f76bfd715325226bb4d7131 [file] [log] [blame]
Richard Trieu23bafad2012-11-07 21:17:13 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Argyrios Kyrtzidisae7b38e2013-06-28 23:47:22 +00002// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
Richard Trieu23bafad2012-11-07 21:17:13 +00003
4template<typename T> class vector2 {};
5template<typename T> class vector : vector2<T> {};
6
Davide Italiano32cbff72015-08-15 15:23:14 +00007template<typename T> void Foo2(vector2<const T*> V) {} // expected-note{{candidate template ignored: cannot deduce a type for 'T' that would make 'const T' equal 'int'}}
8template<typename T> void Foo(vector<const T*> V) {} // expected-note {{candidate template ignored: cannot deduce a type for 'T' that would make 'const T' equal 'int'}}
Richard Trieu23bafad2012-11-07 21:17:13 +00009
10void test() {
11 Foo2(vector2<int*>()); // expected-error{{no matching function for call to 'Foo2'}}
12 Foo(vector<int*>()); // expected-error{{no matching function for call to 'Foo'}}
13}
Douglas Gregor45bb4832013-03-26 23:36:30 +000014
15namespace rdar13267210 {
16 template < typename T > class A {
17 BaseTy; // expected-error{{C++ requires a type specifier for all declarations}}
18 };
19
20 template < typename T, int N > class C: A < T > {};
21
22 class B {
23 C<long, 16> ExternalDefinitions;
24 C<long, 64> &Record;
25
26 void AddSourceLocation(A<long> &R); // expected-note{{passing argument to parameter 'R' here}}
27 void AddTemplateKWAndArgsInfo() {
28 AddSourceLocation(Record); // expected-error{{non-const lvalue reference to type}}
29 }
30 };
31}
Matt Beaumont-Gay76d0b462013-06-21 18:58:32 +000032
33namespace PR16292 {
34 class IncompleteClass; // expected-note{{forward declaration}}
35 class BaseClass {
36 IncompleteClass Foo; // expected-error{{field has incomplete type}}
37 };
38 template<class T> class DerivedClass : public BaseClass {};
39 void* p = new DerivedClass<void>;
40}
Argyrios Kyrtzidisae7b38e2013-06-28 23:47:22 +000041
42namespace rdar14183893 {
43 class Typ { // expected-note {{not complete}}
44 Typ x; // expected-error {{incomplete type}}
45 };
46
47 template <unsigned C> class B : Typ {};
48 typedef B<0> TFP;
49
50 class A {
51 TFP m_p;
52 void Enable() { 0, A(); } // expected-warning {{unused}}
53 };
54}