1910515bc02872bd680e422f75079534d00093bc5Richard Trieu// RUN: %clang_cc1 -fsyntax-only -verify %s 2e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 3910515bc02872bd680e422f75079534d00093bc5Richard Trieu 4910515bc02872bd680e422f75079534d00093bc5Richard Trieutemplate<typename T> class vector2 {}; 5910515bc02872bd680e422f75079534d00093bc5Richard Trieutemplate<typename T> class vector : vector2<T> {}; 6910515bc02872bd680e422f75079534d00093bc5Richard Trieu 7910515bc02872bd680e422f75079534d00093bc5Richard Trieutemplate<typename T> void Foo2(vector2<const T*> V) {} // expected-note{{candidate template ignored: can't deduce a type for 'T' which would make 'const T' equal 'int'}} 8910515bc02872bd680e422f75079534d00093bc5Richard Trieutemplate<typename T> void Foo(vector<const T*> V) {} // expected-note {{candidate template ignored: can't deduce a type for 'T' which would make 'const T' equal 'int'}} 9910515bc02872bd680e422f75079534d00093bc5Richard Trieu 10910515bc02872bd680e422f75079534d00093bc5Richard Trieuvoid test() { 11910515bc02872bd680e422f75079534d00093bc5Richard Trieu Foo2(vector2<int*>()); // expected-error{{no matching function for call to 'Foo2'}} 12910515bc02872bd680e422f75079534d00093bc5Richard Trieu Foo(vector<int*>()); // expected-error{{no matching function for call to 'Foo'}} 13910515bc02872bd680e422f75079534d00093bc5Richard Trieu} 140162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor 150162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregornamespace rdar13267210 { 160162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor template < typename T > class A { 170162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor BaseTy; // expected-error{{C++ requires a type specifier for all declarations}} 180162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor }; 190162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor 200162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor template < typename T, int N > class C: A < T > {}; 210162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor 220162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor class B { 230162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor C<long, 16> ExternalDefinitions; 240162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor C<long, 64> &Record; 250162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor 260162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor void AddSourceLocation(A<long> &R); // expected-note{{passing argument to parameter 'R' here}} 270162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor void AddTemplateKWAndArgsInfo() { 280162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor AddSourceLocation(Record); // expected-error{{non-const lvalue reference to type}} 290162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor } 300162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor }; 310162c1ce296fc48fbe03a31a2ae00b939eef86a8Douglas Gregor} 32538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gay 33538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gaynamespace PR16292 { 34538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gay class IncompleteClass; // expected-note{{forward declaration}} 35538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gay class BaseClass { 36538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gay IncompleteClass Foo; // expected-error{{field has incomplete type}} 37538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gay }; 38538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gay template<class T> class DerivedClass : public BaseClass {}; 39538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gay void* p = new DerivedClass<void>; 40538fccb44c521f5f26e7aa4cebf6a55284e28b3dMatt Beaumont-Gay} 41e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis 42e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidisnamespace rdar14183893 { 43e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis class Typ { // expected-note {{not complete}} 44e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis Typ x; // expected-error {{incomplete type}} 45e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis }; 46e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis 47e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis template <unsigned C> class B : Typ {}; 48e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis typedef B<0> TFP; 49e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis 50e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis class A { 51e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis TFP m_p; 52e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis void Enable() { 0, A(); } // expected-warning {{unused}} 53e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis }; 54e36c7281258a714a2b9116b9cb3d9361f12fd3c9Argyrios Kyrtzidis} 55