diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-01 10:34:51 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-01 10:34:51 +0000 |
commit | abe15e553e58165e7692c0d0842865c488ed7b45 (patch) | |
tree | 1e68501209c9133fbda8d45171e59f8d6f12dd55 /test/SemaTemplate | |
parent | 34d02d0b37f16015f317a935c48ce8b7b64ae77b (diff) | |
download | src-abe15e553e58165e7692c0d0842865c488ed7b45.tar.gz src-abe15e553e58165e7692c0d0842865c488ed7b45.zip |
Updaet clang to 92395.
Notes
Notes:
svn path=/vendor/clang/dist/; revision=201361
Diffstat (limited to 'test/SemaTemplate')
130 files changed, 361 insertions, 172 deletions
diff --git a/test/SemaTemplate/ackermann.cpp b/test/SemaTemplate/ackermann.cpp index c936889f25f9..9525bfcc4f43 100644 --- a/test/SemaTemplate/ackermann.cpp +++ b/test/SemaTemplate/ackermann.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // template<unsigned M, unsigned N> // struct Ackermann { diff --git a/test/SemaTemplate/ambiguous-ovl-print.cpp b/test/SemaTemplate/ambiguous-ovl-print.cpp index ccdeb9bebc57..17f412f6716d 100644 --- a/test/SemaTemplate/ambiguous-ovl-print.cpp +++ b/test/SemaTemplate/ambiguous-ovl-print.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s void f(void*, int); // expected-note{{candidate function}} template<typename T> diff --git a/test/SemaTemplate/anonymous-union.cpp b/test/SemaTemplate/anonymous-union.cpp new file mode 100644 index 000000000000..59d1f25a4fd2 --- /dev/null +++ b/test/SemaTemplate/anonymous-union.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR5868 +struct T0 { + int x; + union { + void *m0; + }; +}; +template <typename T> +struct T1 : public T0, public T { + void f0() { + m0 = 0; // expected-error{{ambiguous conversion}} + } +}; + +struct A : public T0 { }; + +void f1(T1<A> *S) { S->f0(); } // expected-note{{instantiation of member function}} diff --git a/test/SemaTemplate/canonical-expr-type-0x.cpp b/test/SemaTemplate/canonical-expr-type-0x.cpp index 21552105b0ff..73cf3c29665c 100644 --- a/test/SemaTemplate/canonical-expr-type-0x.cpp +++ b/test/SemaTemplate/canonical-expr-type-0x.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s void f(); diff --git a/test/SemaTemplate/canonical-expr-type.cpp b/test/SemaTemplate/canonical-expr-type.cpp index 0580c677e627..7582df5e66aa 100644 --- a/test/SemaTemplate/canonical-expr-type.cpp +++ b/test/SemaTemplate/canonical-expr-type.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s void f(); diff --git a/test/SemaTemplate/class-template-ctor-initializer.cpp b/test/SemaTemplate/class-template-ctor-initializer.cpp index d7649f52688d..fd9417c795f6 100644 --- a/test/SemaTemplate/class-template-ctor-initializer.cpp +++ b/test/SemaTemplate/class-template-ctor-initializer.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<class X> struct A {}; diff --git a/test/SemaTemplate/class-template-decl.cpp b/test/SemaTemplate/class-template-decl.cpp index a8163127b000..71aabe97f4e3 100644 --- a/test/SemaTemplate/class-template-decl.cpp +++ b/test/SemaTemplate/class-template-decl.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> class A; diff --git a/test/SemaTemplate/class-template-id-2.cpp b/test/SemaTemplate/class-template-id-2.cpp index c4388a7c1556..c492a365880c 100644 --- a/test/SemaTemplate/class-template-id-2.cpp +++ b/test/SemaTemplate/class-template-id-2.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace N { template<typename T> class A { }; diff --git a/test/SemaTemplate/class-template-id.cpp b/test/SemaTemplate/class-template-id.cpp index 98ccbe7db6f8..df5ef554f7aa 100644 --- a/test/SemaTemplate/class-template-id.cpp +++ b/test/SemaTemplate/class-template-id.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, typename U = float> struct A { }; typedef A<int> A_int; @@ -9,9 +9,9 @@ A<int, FLOAT> *foo(A<int> *ptr, A<int> const *ptr2, A<int, double> *ptr3) { if (ptr) return ptr; // okay else if (ptr2) - return ptr2; // expected-error{{incompatible type returning 'A<int> const *', expected 'A<int, FLOAT> *'}} + return ptr2; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' with an lvalue of type 'A<int> const *'}} else { - return ptr3; // expected-error{{incompatible type returning 'A<int, double> *', expected 'A<int, FLOAT> *'}} + return ptr3; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' with an lvalue of type 'A<int, double> *'}} } } @@ -24,7 +24,7 @@ B<17 + 2> *bar(B<(19)> *ptr1, B< (::value + 7) > *ptr2, B<19 - 3> *ptr3) { else if (ptr2) return ptr2; else - return ptr3; // expected-error{{incompatible type returning 'B<19 - 3> *', expected 'B<17 + 2> *'}} + return ptr3; // expected-error{{cannot initialize return object of type 'B<17 + 2> *' with an lvalue of type 'B<19 - 3>}} } typedef B<5> B5; diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp index 2808404b1d99..efb00c7f3d25 100644 --- a/test/SemaTemplate/class-template-spec.cpp +++ b/test/SemaTemplate/class-template-spec.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, typename U = int> struct A; // expected-note {{template is declared here}} \ // expected-note{{explicitly specialized}} diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp index 0b6916fa485d..139de9d68605 100644 --- a/test/SemaTemplate/constructor-template.cpp +++ b/test/SemaTemplate/constructor-template.cpp @@ -1,11 +1,11 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct X0 { // expected-note{{candidate}} X0(int); // expected-note{{candidate}} - template<typename T> X0(T); - template<typename T, typename U> X0(T*, U*); + template<typename T> X0(T); // expected-note {{candidate}} + template<typename T, typename U> X0(T*, U*); // expected-note {{candidate}} // PR4761 - template<typename T> X0() : f0(T::foo) {} + template<typename T> X0() : f0(T::foo) {} // expected-note {{candidate}} int f0; }; @@ -52,7 +52,7 @@ template <> struct A<int>{A(const A<int>&);}; struct B { A<int> x; B(B& a) : x(a.x) {} }; struct X2 { - X2(); + X2(); // expected-note{{candidate function}} X2(X2&); // expected-note {{candidate function}} template<typename T> X2(T); }; @@ -61,7 +61,7 @@ X2 test(bool Cond, X2 x2) { if (Cond) return x2; // okay, uses copy constructor - return X2(); // expected-error{{no viable conversion from 'struct X2' to 'struct X2' is possible}} + return X2(); // expected-error{{no matching constructor}} } struct X3 { @@ -71,7 +71,7 @@ struct X3 { template<> X3::X3(X3); // expected-error{{must pass its first argument by reference}} struct X4 { - X4(); + X4(); // expected-note{{candidate function}} ~X4(); X4(X4&); // expected-note {{candidate function}} template<typename T> X4(const T&, int = 17); @@ -80,7 +80,7 @@ struct X4 { X4 test_X4(bool Cond, X4 x4) { X4 a(x4, 17); // okay, constructor template X4 b(x4); // okay, copy constructor - return X4(); // expected-error{{no viable conversion}} + return X4(); // expected-error{{no matching constructor}} } // Instantiation of a non-dependent use of a constructor diff --git a/test/SemaTemplate/copy-ctor-assign.cpp b/test/SemaTemplate/copy-ctor-assign.cpp index 69481ea557f4..ae6dc9c30fa1 100644 --- a/test/SemaTemplate/copy-ctor-assign.cpp +++ b/test/SemaTemplate/copy-ctor-assign.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Make sure that copy constructors and assignment operators are properly // generated when there is a matching diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp index fe2c558a3d21..45637484f0fd 100644 --- a/test/SemaTemplate/current-instantiation.cpp +++ b/test/SemaTemplate/current-instantiation.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // This test concerns the identity of dependent types within the // canonical type system, specifically focusing on the difference diff --git a/test/SemaTemplate/deduction.cpp b/test/SemaTemplate/deduction.cpp index 7b7e18f74aec..375d199f5899 100644 --- a/test/SemaTemplate/deduction.cpp +++ b/test/SemaTemplate/deduction.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s // Template argument deduction with template template parameters. template<typename T, template<T> class A> @@ -81,3 +81,8 @@ int array1[is_same<Replace<const _1, int, float>::type, const int>::value? 1 : - int array2[is_same<Replace<vector<_1>, int, float>::type, vector<int> >::value? 1 : -1]; int array3[is_same<Replace<vector<const _1>, int, float>::type, vector<const int> >::value? 1 : -1]; int array4[is_same<Replace<vector<int, _2>, double, float>::type, vector<int, float> >::value? 1 : -1]; + +// PR5911 +template <typename T, int N> void f(const T (&a)[N]); +int iarr[] = { 1 }; +void test_PR5911() { f(iarr); } diff --git a/test/SemaTemplate/default-arguments-cxx0x.cpp b/test/SemaTemplate/default-arguments-cxx0x.cpp index 8d8833c6702e..0f7ba4678b8e 100644 --- a/test/SemaTemplate/default-arguments-cxx0x.cpp +++ b/test/SemaTemplate/default-arguments-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s // Test default template arguments for function templates. template<typename T = int> diff --git a/test/SemaTemplate/default-arguments.cpp b/test/SemaTemplate/default-arguments.cpp index 0247ddc0ef28..9ea0fc2e4d52 100644 --- a/test/SemaTemplate/default-arguments.cpp +++ b/test/SemaTemplate/default-arguments.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, int N = 2> struct X; // expected-note{{template is declared here}} X<int, 1> *x1; diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp index 34ac2d967efc..0edc504ea0a3 100644 --- a/test/SemaTemplate/default-expr-arguments.cpp +++ b/test/SemaTemplate/default-expr-arguments.cpp @@ -1,14 +1,13 @@ -// RUN: clang-cc -fsyntax-only -verify %s - +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> class C { C(int a0 = 0); }; template<> C<char>::C(int a0); -struct S { }; +struct S { }; // expected-note 3 {{candidate function}} -template<typename T> void f1(T a, T b = 10) { } // expected-error{{cannot initialize 'b' with an rvalue of type 'int'}} +template<typename T> void f1(T a, T b = 10) { } // expected-error{{no viable conversion}} template<typename T> void f2(T a, T b = T()) { } @@ -26,8 +25,8 @@ void g() { } template<typename T> struct F { - F(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}} - void f(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}} + F(T t = 10); // expected-error{{no viable conversion}} + void f(T t = 10); // expected-error{{no viable conversion}} }; struct FD : F<int> { }; @@ -100,7 +99,7 @@ void test_x2(X2<int> x2i, X2<NotDefaultConstructible> x2n) { // PR5283 namespace PR5283 { template<typename T> struct A { - A(T = 1); // expected-error 3 {{incompatible type initializing 'int', expected 'int *'}} + A(T = 1); // expected-error 3 {{cannot initialize a parameter of type 'int *' with an rvalue of type 'int'}} }; struct B : A<int*> { @@ -144,3 +143,37 @@ namespace pr5301 { } } +// PR5810 +namespace PR5810 { + template<typename T> + struct allocator { + allocator() { int a[sizeof(T) ? -1 : -1]; } // expected-error2 {{array size is negative}} + }; + + template<typename T> + struct vector { + vector(const allocator<T>& = allocator<T>()) {} // expected-note2 {{instantiation of}} + }; + + struct A { }; + struct B { }; + + template<typename> + void FilterVTs() { + vector<A> Result; + } + + void f() { + vector<A> Result; + } + + template<typename T> + struct X { + vector<B> bs; + X() { } + }; + + void f2() { + X<float> x; // expected-note{{member function}} + } +} diff --git a/test/SemaTemplate/dependent-base-member-init.cpp b/test/SemaTemplate/dependent-base-member-init.cpp index b3d707b632b1..c9823d227d4c 100644 --- a/test/SemaTemplate/dependent-base-member-init.cpp +++ b/test/SemaTemplate/dependent-base-member-init.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR4381 template<class T> struct X {}; diff --git a/test/SemaTemplate/dependent-expr.cpp b/test/SemaTemplate/dependent-expr.cpp new file mode 100644 index 000000000000..412a811f7292 --- /dev/null +++ b/test/SemaTemplate/dependent-expr.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR5908 +template <typename Iterator> +void Test(Iterator it) { + *(it += 1); +} diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp index aef43cb29db4..a2d3c56501e8 100644 --- a/test/SemaTemplate/dependent-names.cpp +++ b/test/SemaTemplate/dependent-names.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s typedef double A; template<typename T> class B { @@ -84,3 +84,17 @@ namespace test0 { d2.test3(); // expected-note {{in instantiation of member function}} } } + +namespace test1 { + template <class T> struct Base { + void foo(T); // expected-note {{must qualify identifier to find this declaration in dependent base class}} + }; + + template <class T> struct Derived : Base<T> { + void doFoo(T v) { + foo(v); // expected-error {{use of undeclared identifier}} + } + }; + + template struct Derived<int>; // expected-note {{requested here}} +} diff --git a/test/SemaTemplate/dependent-sized_array.cpp b/test/SemaTemplate/dependent-sized_array.cpp index d221a4d276d2..cf0e0f37ee04 100644 --- a/test/SemaTemplate/dependent-sized_array.cpp +++ b/test/SemaTemplate/dependent-sized_array.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s template<int N> void f() { diff --git a/test/SemaTemplate/dependent-type-identity.cpp b/test/SemaTemplate/dependent-type-identity.cpp index b7c9040e6cb5..e09581223af6 100644 --- a/test/SemaTemplate/dependent-type-identity.cpp +++ b/test/SemaTemplate/dependent-type-identity.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // This test concerns the identity of dependent types within the // canonical type system. This corresponds to C++ [temp.type], which diff --git a/test/SemaTemplate/destructor-template.cpp b/test/SemaTemplate/destructor-template.cpp index afe2cfc30019..b5ad967d69d5 100644 --- a/test/SemaTemplate/destructor-template.cpp +++ b/test/SemaTemplate/destructor-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename A> class s0 { diff --git a/test/SemaTemplate/enum-argument.cpp b/test/SemaTemplate/enum-argument.cpp index 1d782df202e3..de89487bd581 100644 --- a/test/SemaTemplate/enum-argument.cpp +++ b/test/SemaTemplate/enum-argument.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s enum Enum { val = 1 }; template <Enum v> struct C { diff --git a/test/SemaTemplate/example-dynarray.cpp b/test/SemaTemplate/example-dynarray.cpp index 6f3e58e32ab6..1f6ede67a522 100644 --- a/test/SemaTemplate/example-dynarray.cpp +++ b/test/SemaTemplate/example-dynarray.cpp @@ -1,4 +1,4 @@ -// RUN: clang -emit-llvm -S -o %t %s +// RUN: %clang -emit-llvm -S -o %t %s #include <stddef.h> #include <stdlib.h> #include <assert.h> diff --git a/test/SemaTemplate/example-typelist.cpp b/test/SemaTemplate/example-typelist.cpp index 4a2aeb20e730..082aeb83fbdd 100644 --- a/test/SemaTemplate/example-typelist.cpp +++ b/test/SemaTemplate/example-typelist.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // A simple cons-style typelist struct nil { }; diff --git a/test/SemaTemplate/explicit-instantiation.cpp b/test/SemaTemplate/explicit-instantiation.cpp index b04639f6e78c..fbb5edbefd6c 100644 --- a/test/SemaTemplate/explicit-instantiation.cpp +++ b/test/SemaTemplate/explicit-instantiation.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template void *; // expected-error{{expected unqualified-id}} @@ -25,8 +25,8 @@ T X0<T>::value; // expected-error{{no matching constructor}} template int X0<int>::value; -struct NotDefaultConstructible { - NotDefaultConstructible(int); +struct NotDefaultConstructible { // expected-note{{candidate function}} + NotDefaultConstructible(int); // expected-note{{candidate function}} }; template NotDefaultConstructible X0<NotDefaultConstructible>::value; // expected-note{{instantiation}} diff --git a/test/SemaTemplate/explicit-specialization-member.cpp b/test/SemaTemplate/explicit-specialization-member.cpp index 197dae5a15af..06dd382fc7a4 100644 --- a/test/SemaTemplate/explicit-specialization-member.cpp +++ b/test/SemaTemplate/explicit-specialization-member.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct X0 { typedef T* type; diff --git a/test/SemaTemplate/ext-vector-type.cpp b/test/SemaTemplate/ext-vector-type.cpp index 7cc4ae930ed2..0e2debf22b99 100644 --- a/test/SemaTemplate/ext-vector-type.cpp +++ b/test/SemaTemplate/ext-vector-type.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, unsigned Length> struct make1 { typedef T __attribute__((ext_vector_type(Length))) type; diff --git a/test/SemaTemplate/extern-templates.cpp b/test/SemaTemplate/extern-templates.cpp index 44728d188a24..eca64ed595eb 100644 --- a/test/SemaTemplate/extern-templates.cpp +++ b/test/SemaTemplate/extern-templates.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> class X0 { diff --git a/test/SemaTemplate/fibonacci.cpp b/test/SemaTemplate/fibonacci.cpp index 6cd50157e2bd..ff1711fc529f 100644 --- a/test/SemaTemplate/fibonacci.cpp +++ b/test/SemaTemplate/fibonacci.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s template<unsigned I> struct FibonacciEval; diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp index 98992f6f6078..05289b10d26c 100644 --- a/test/SemaTemplate/friend-template.cpp +++ b/test/SemaTemplate/friend-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR5057 namespace test0 { @@ -97,3 +97,13 @@ namespace test4 { f(A<int>()); // expected-note {{in instantiation of function template specialization}} } } + +namespace test5 { + class outer { + class foo; + template <typename T> friend struct cache; + }; + class outer::foo { + template <typename T> friend struct cache; + }; +} diff --git a/test/SemaTemplate/friend.cpp b/test/SemaTemplate/friend.cpp index 27299523862e..61ef1865da5d 100644 --- a/test/SemaTemplate/friend.cpp +++ b/test/SemaTemplate/friend.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct A { struct B { }; diff --git a/test/SemaTemplate/fun-template-def.cpp b/test/SemaTemplate/fun-template-def.cpp index 4d8aaa8d16f1..0c2cf9c4f2e6 100644 --- a/test/SemaTemplate/fun-template-def.cpp +++ b/test/SemaTemplate/fun-template-def.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Tests that dependent expressions are always allowed, whereas non-dependent // are checked as usual. @@ -8,7 +8,7 @@ // Fake typeid, lacking a typeinfo header. namespace std { class type_info {}; } -struct dummy {}; +struct dummy {}; // expected-note 3 {{candidate function}} template<typename T> int f0(T x) { @@ -39,9 +39,9 @@ T f1(T t1, U u1, int i1) new (t1, u1) int; delete t1; - dummy d1 = sizeof(t1); // FIXME: delayed checking okay? - dummy d2 = offsetof(T, foo); // expected-error {{cannot initialize 'd2'}} - dummy d3 = __alignof(u1); // FIXME: delayed checking okay? + dummy d1 = sizeof(t1); // expected-error {{no viable conversion}} + dummy d2 = offsetof(T, foo); // expected-error {{no viable conversion}} + dummy d3 = __alignof(u1); // expected-error {{no viable conversion}} i1 = typeid(t1); // expected-error {{incompatible type assigning}} return u1; diff --git a/test/SemaTemplate/function-template-specialization.cpp b/test/SemaTemplate/function-template-specialization.cpp index 90e38cc882fe..91989b1ccae0 100644 --- a/test/SemaTemplate/function-template-specialization.cpp +++ b/test/SemaTemplate/function-template-specialization.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<int N> void f0(int (&array)[N]); diff --git a/test/SemaTemplate/implicit-instantiation-1.cpp b/test/SemaTemplate/implicit-instantiation-1.cpp index d04bbd848407..d1bc5a89da15 100644 --- a/test/SemaTemplate/implicit-instantiation-1.cpp +++ b/test/SemaTemplate/implicit-instantiation-1.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, typename U> struct X { T f(T x, U y) { return x + y; } diff --git a/test/SemaTemplate/injected-class-name.cpp b/test/SemaTemplate/injected-class-name.cpp index f9674c39a58b..1a65aeb3d6cb 100644 --- a/test/SemaTemplate/injected-class-name.cpp +++ b/test/SemaTemplate/injected-class-name.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct X { X<T*> *ptr; diff --git a/test/SemaTemplate/instantiate-anonymous-union.cpp b/test/SemaTemplate/instantiate-anonymous-union.cpp index 375c1da3ca59..7c75885788de 100644 --- a/test/SemaTemplate/instantiate-anonymous-union.cpp +++ b/test/SemaTemplate/instantiate-anonymous-union.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s -Wall +// RUN: %clang_cc1 -fsyntax-only %s -Wall template <typename T> class A { struct { }; }; diff --git a/test/SemaTemplate/instantiate-array.cpp b/test/SemaTemplate/instantiate-array.cpp index 29279b436899..97ea6cbb8e53 100644 --- a/test/SemaTemplate/instantiate-array.cpp +++ b/test/SemaTemplate/instantiate-array.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x #ifndef __GXX_EXPERIMENTAL_CXX0X__ #define __CONCAT(__X, __Y) __CONCAT1(__X, __Y) diff --git a/test/SemaTemplate/instantiate-attr.cpp b/test/SemaTemplate/instantiate-attr.cpp index 08ba9c3a0cd5..7fb173645932 100644 --- a/test/SemaTemplate/instantiate-attr.cpp +++ b/test/SemaTemplate/instantiate-attr.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template <typename T> struct A { char a __attribute__((aligned(16))); diff --git a/test/SemaTemplate/instantiate-c99.cpp b/test/SemaTemplate/instantiate-c99.cpp index cf691cffad36..ae1552887b26 100644 --- a/test/SemaTemplate/instantiate-c99.cpp +++ b/test/SemaTemplate/instantiate-c99.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Test template instantiation for C99-specific features. diff --git a/test/SemaTemplate/instantiate-call.cpp b/test/SemaTemplate/instantiate-call.cpp index a9c4bf481ded..ad06be33aa2b 100644 --- a/test/SemaTemplate/instantiate-call.cpp +++ b/test/SemaTemplate/instantiate-call.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace N1 { struct X0 { }; @@ -24,7 +24,7 @@ namespace N3 { template<typename T, typename Result> struct call_f0 { void test_f0(T t) { - Result &result = f0(t); // expected-error 2{{no matching}} + Result &result = f0(t); // expected-error 2{{undeclared identifier}} } }; } diff --git a/test/SemaTemplate/instantiate-case.cpp b/test/SemaTemplate/instantiate-case.cpp index bed39d7ffb06..1cc2d5d6c62a 100644 --- a/test/SemaTemplate/instantiate-case.cpp +++ b/test/SemaTemplate/instantiate-case.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<class T> static int alpha(T c) diff --git a/test/SemaTemplate/instantiate-cast.cpp b/test/SemaTemplate/instantiate-cast.cpp index c3c318f36d5d..97d3dc30c56c 100644 --- a/test/SemaTemplate/instantiate-cast.cpp +++ b/test/SemaTemplate/instantiate-cast.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct A { int x; }; diff --git a/test/SemaTemplate/instantiate-clang.cpp b/test/SemaTemplate/instantiate-clang.cpp index a6c28d9e19db..cef2b7090bf2 100644 --- a/test/SemaTemplate/instantiate-clang.cpp +++ b/test/SemaTemplate/instantiate-clang.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Test template instantiation for Clang-specific features. diff --git a/test/SemaTemplate/instantiate-complete.cpp b/test/SemaTemplate/instantiate-complete.cpp index 507894a2ff69..183fefab4116 100644 --- a/test/SemaTemplate/instantiate-complete.cpp +++ b/test/SemaTemplate/instantiate-complete.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Tests various places where requiring a complete type involves // instantiation of that type. diff --git a/test/SemaTemplate/instantiate-decl-dtor.cpp b/test/SemaTemplate/instantiate-decl-dtor.cpp new file mode 100644 index 000000000000..193d9764c28c --- /dev/null +++ b/test/SemaTemplate/instantiate-decl-dtor.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify + +template <typename T> struct A { + T x; + A(int y) { x = y; } + ~A() { *x = 10; } // expected-error {{indirection requires pointer operand}} +}; + +void a() { + A<int> b = 10; // expected-note {{requested here}} +} diff --git a/test/SemaTemplate/instantiate-decl-init.cpp b/test/SemaTemplate/instantiate-decl-init.cpp index d957f2de7da5..b0c2aa8afa91 100644 --- a/test/SemaTemplate/instantiate-decl-init.cpp +++ b/test/SemaTemplate/instantiate-decl-init.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR5426 - the non-dependent obj would be fully processed and wrapped in a // CXXConstructExpr at definition time, which would lead to a failure at diff --git a/test/SemaTemplate/instantiate-declref-ice.cpp b/test/SemaTemplate/instantiate-declref-ice.cpp index ab12b90f6c98..e4e071dd20d7 100644 --- a/test/SemaTemplate/instantiate-declref-ice.cpp +++ b/test/SemaTemplate/instantiate-declref-ice.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<int i> struct x { static const int j = i; diff --git a/test/SemaTemplate/instantiate-declref.cpp b/test/SemaTemplate/instantiate-declref.cpp index 359e2c7dfaa4..da8b263ab3ab 100644 --- a/test/SemaTemplate/instantiate-declref.cpp +++ b/test/SemaTemplate/instantiate-declref.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace N { struct Outer { struct Inner { diff --git a/test/SemaTemplate/instantiate-deeply.cpp b/test/SemaTemplate/instantiate-deeply.cpp index 7f15bf1200f1..c5f65945afcb 100644 --- a/test/SemaTemplate/instantiate-deeply.cpp +++ b/test/SemaTemplate/instantiate-deeply.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -Wall -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s template<typename a> struct A { template <typename b> struct B { template <typename c> struct C { diff --git a/test/SemaTemplate/instantiate-default-assignment-operator.cpp b/test/SemaTemplate/instantiate-default-assignment-operator.cpp index b0ac078893de..5594d6c7d799 100644 --- a/test/SemaTemplate/instantiate-default-assignment-operator.cpp +++ b/test/SemaTemplate/instantiate-default-assignment-operator.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename> struct PassRefPtr { }; template<typename T> struct RefPtr { RefPtr& operator=(const RefPtr&) { int a[sizeof(T) ? -1 : -1];} // expected-error 2 {{array size is negative}} diff --git a/test/SemaTemplate/instantiate-dependent-nested-name.cpp b/test/SemaTemplate/instantiate-dependent-nested-name.cpp index 2b1d29878a54..eb1d3fba10ed 100644 --- a/test/SemaTemplate/instantiate-dependent-nested-name.cpp +++ b/test/SemaTemplate/instantiate-dependent-nested-name.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR4382 template<typename T> struct X { static const T A = 1; }; template<typename T, bool = X<T>::A> struct Y { typedef T A; }; diff --git a/test/SemaTemplate/instantiate-enum-2.cpp b/test/SemaTemplate/instantiate-enum-2.cpp index 2b56a036e947..aa3b590cada4 100644 --- a/test/SemaTemplate/instantiate-enum-2.cpp +++ b/test/SemaTemplate/instantiate-enum-2.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: %clang_cc1 %s -fsyntax-only -verify template<int IntBits> struct X { enum { diff --git a/test/SemaTemplate/instantiate-enum.cpp b/test/SemaTemplate/instantiate-enum.cpp index a7acf22a45a1..6f9aa4b116d7 100644 --- a/test/SemaTemplate/instantiate-enum.cpp +++ b/test/SemaTemplate/instantiate-enum.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s template<typename T, T I, int J> struct adder { diff --git a/test/SemaTemplate/instantiate-exception-spec.cpp b/test/SemaTemplate/instantiate-exception-spec.cpp index 31db4487a27a..c418fe16e87f 100644 --- a/test/SemaTemplate/instantiate-exception-spec.cpp +++ b/test/SemaTemplate/instantiate-exception-spec.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // FIXME: the "note" should be down at the call site! template<typename T> void f1(T*) throw(T); // expected-error{{incomplete type 'struct Incomplete' is not allowed in exception specification}} \ diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp index 1cd55d9ad257..663749ddce5b 100644 --- a/test/SemaTemplate/instantiate-expr-1.cpp +++ b/test/SemaTemplate/instantiate-expr-1.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<int I, int J> struct Bitfields { int simple : I; // expected-error{{bit-field 'simple' has zero width}} diff --git a/test/SemaTemplate/instantiate-expr-2.cpp b/test/SemaTemplate/instantiate-expr-2.cpp index 194593ac4006..4da4e713ec18 100644 --- a/test/SemaTemplate/instantiate-expr-2.cpp +++ b/test/SemaTemplate/instantiate-expr-2.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s typedef char one_byte; typedef char (&two_bytes)[2]; typedef char (&four_bytes)[4]; diff --git a/test/SemaTemplate/instantiate-expr-3.cpp b/test/SemaTemplate/instantiate-expr-3.cpp index 696b58325cd7..41a96a32e0bf 100644 --- a/test/SemaTemplate/instantiate-expr-3.cpp +++ b/test/SemaTemplate/instantiate-expr-3.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // --------------------------------------------------------------------- // Imaginary literals diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp index b99ec3304c4d..c524e958f8a7 100644 --- a/test/SemaTemplate/instantiate-expr-4.cpp +++ b/test/SemaTemplate/instantiate-expr-4.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // --------------------------------------------------------------------- // C++ Functional Casts @@ -21,8 +21,8 @@ struct FunctionalCast0 { template struct FunctionalCast0<5>; -struct X { // expected-note 2 {{candidate function}} - X(int, int); // expected-note 2 {{candidate function}} +struct X { // expected-note 3 {{candidate function}} + X(int, int); // expected-note 3 {{candidate function}} }; template<int N, int M> @@ -84,6 +84,20 @@ template struct New2<X, int, float>; template struct New2<X, int, int*>; // expected-note{{instantiation}} // FIXME: template struct New2<int, int, float>; +// PR5833 +struct New3 { + New3(); + + void *operator new[](__SIZE_TYPE__) __attribute__((unavailable)); // expected-note{{explicitly made unavailable}} +}; + +template<class C> +void* object_creator() { + return new C(); // expected-error{{call to unavailable function 'operator new[]'}} +} + +template void *object_creator<New3[4]>(); // expected-note{{instantiation}} + template<typename T> struct Delete0 { void f(T t) { @@ -119,7 +133,7 @@ struct Throw1 { } }; -struct Incomplete; // expected-note{{forward}} +struct Incomplete; // expected-note 2{{forward}} template struct Throw1<int>; template struct Throw1<int*>; @@ -129,7 +143,6 @@ template struct Throw1<Incomplete*>; // expected-note{{instantiation}} // typeid expressions // --------------------------------------------------------------------- -// FIXME: This should really include <typeinfo>, but we don't have that yet. namespace std { class type_info; } @@ -140,7 +153,7 @@ struct TypeId0 { if (ptr) return typeid(ptr); else - return typeid(T); + return typeid(T); // expected-error{{'typeid' of incomplete type 'struct Incomplete'}} } }; @@ -149,7 +162,7 @@ struct Abstract { }; template struct TypeId0<int>; -template struct TypeId0<Incomplete>; +template struct TypeId0<Incomplete>; // expected-note{{instantiation of member function}} template struct TypeId0<Abstract>; // --------------------------------------------------------------------- @@ -293,7 +306,7 @@ template struct NonDepMemberCall0<float&>; // expected-note{{instantiation}} template<typename T> struct QualifiedDeclRef0 { T f() { - return is_pod<X>::value; // expected-error{{initialized}} + return is_pod<X>::value; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'bool const'}} } }; diff --git a/test/SemaTemplate/instantiate-expr-5.cpp b/test/SemaTemplate/instantiate-expr-5.cpp index b42c0fb2aaf8..941dae44829a 100644 --- a/test/SemaTemplate/instantiate-expr-5.cpp +++ b/test/SemaTemplate/instantiate-expr-5.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s template <class A> int x(A x) { return x++; } int y() { return x<int>(1); } diff --git a/test/SemaTemplate/instantiate-expr-basic.cpp b/test/SemaTemplate/instantiate-expr-basic.cpp index 2b5fcaeb0454..074fe6941490 100644 --- a/test/SemaTemplate/instantiate-expr-basic.cpp +++ b/test/SemaTemplate/instantiate-expr-basic.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -Wno-unused-value -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++0x %s template <typename T> struct S { diff --git a/test/SemaTemplate/instantiate-field.cpp b/test/SemaTemplate/instantiate-field.cpp index 8e2a3758b0d7..d166e7e78e6a 100644 --- a/test/SemaTemplate/instantiate-field.cpp +++ b/test/SemaTemplate/instantiate-field.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct X { diff --git a/test/SemaTemplate/instantiate-friend-class.cpp b/test/SemaTemplate/instantiate-friend-class.cpp index 9a4a73cc8a52..c87b8d0bf9b2 100644 --- a/test/SemaTemplate/instantiate-friend-class.cpp +++ b/test/SemaTemplate/instantiate-friend-class.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR4794 template <class T> class X diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp index a6c269febea1..543b3cc19759 100644 --- a/test/SemaTemplate/instantiate-function-1.cpp +++ b/test/SemaTemplate/instantiate-function-1.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, typename U> struct X0 { void f(T x, U y) { @@ -66,7 +66,7 @@ template<typename T, typename U, typename V> struct X6 { return u; else { if (t < 0) - return v; // expected-error{{incompatible type}} + return v; // expected-error{{cannot initialize return object of type}} } if (T x = t) { diff --git a/test/SemaTemplate/instantiate-function-1.mm b/test/SemaTemplate/instantiate-function-1.mm index aa4b941d39cf..c67b5985f63f 100644 --- a/test/SemaTemplate/instantiate-function-1.mm +++ b/test/SemaTemplate/instantiate-function-1.mm @@ -1,4 +1,4 @@ -// RUN: clang -cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // XFAIL: * template<typename T> struct Member0 { diff --git a/test/SemaTemplate/instantiate-function-2.cpp b/test/SemaTemplate/instantiate-function-2.cpp index 51a60146d46a..6318facfc0ea 100644 --- a/test/SemaTemplate/instantiate-function-2.cpp +++ b/test/SemaTemplate/instantiate-function-2.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template <typename T> struct S { S() { } S(T t); diff --git a/test/SemaTemplate/instantiate-init.cpp b/test/SemaTemplate/instantiate-init.cpp index 870b27537fce..8a10a87e610e 100644 --- a/test/SemaTemplate/instantiate-init.cpp +++ b/test/SemaTemplate/instantiate-init.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct X0 { // expected-note 4{{candidate}} X0(int*, float*); // expected-note 4{{candidate}} diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp index fab65cef2e45..8a19d74cdde4 100644 --- a/test/SemaTemplate/instantiate-member-class.cpp +++ b/test/SemaTemplate/instantiate-member-class.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> class X { @@ -36,3 +36,17 @@ void test_instantiation(X<double>::C *x, X<void>::C *c3; // okay X<void>::D::E *e1; // okay X<void>::D::E e2; // expected-note{{in instantiation of member class 'struct X<void>::D::E' requested here}} + +// Redeclarations. +namespace test1 { + template <typename T> struct Registry { + class node; + static node *Head; + class node { + node(int v) { Head = this; } + }; + }; + void test() { + Registry<int>::node node(0); + } +} diff --git a/test/SemaTemplate/instantiate-member-expr.cpp b/test/SemaTemplate/instantiate-member-expr.cpp new file mode 100644 index 000000000000..db13624d4426 --- /dev/null +++ b/test/SemaTemplate/instantiate-member-expr.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template<typename T> +struct S { + S() { } +}; + +template<typename T> +struct vector { + void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array size is negative}} +}; + +class GRExprEngine { +public: + typedef vector<S<void *> >CheckersOrdered; + CheckersOrdered Checkers; + + template <typename CHECKER> + void registerCheck(CHECKER *check) { + Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<struct S<void *> >::push_back' requested here}} + } +}; + +class RetainReleaseChecker { }; + +void f(GRExprEngine& Eng) { + Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<class RetainReleaseChecker>' requested here}} +} diff --git a/test/SemaTemplate/instantiate-member-initializers.cpp b/test/SemaTemplate/instantiate-member-initializers.cpp index 6fc70429a9d3..f7b7e47e1e9b 100644 --- a/test/SemaTemplate/instantiate-member-initializers.cpp +++ b/test/SemaTemplate/instantiate-member-initializers.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -Wall -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s template<typename T> struct A { A() : a(1) { } // expected-error{{incompatible type passing 'int', expected 'void *'}} diff --git a/test/SemaTemplate/instantiate-member-pointers.cpp b/test/SemaTemplate/instantiate-member-pointers.cpp index d2c9e6b5ed82..2308ac541b2e 100644 --- a/test/SemaTemplate/instantiate-member-pointers.cpp +++ b/test/SemaTemplate/instantiate-member-pointers.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct Y { int x; }; diff --git a/test/SemaTemplate/instantiate-member-template.cpp b/test/SemaTemplate/instantiate-member-template.cpp index 04ced926341a..b4f0a9c6509d 100644 --- a/test/SemaTemplate/instantiate-member-template.cpp +++ b/test/SemaTemplate/instantiate-member-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct X0 { @@ -50,7 +50,7 @@ struct X1 { template<typename V> V f1(T t, U u, V) { - return t + u; // expected-error{{incompatible type}} + return t + u; // expected-error{{cannot initialize return object}} } }; @@ -75,7 +75,7 @@ template<typename T> template<typename U> template<typename V> V X1<T>::Inner4<U>::f2(T t, U u, V) { - return t + u; // expected-error{{incompatible type}} + return t + u; // expected-error{{cannot initialize return object}} } void test_X1(int *ip, int i, double *dp) { @@ -90,7 +90,7 @@ void test_X1(int *ip, int i, double *dp) { X1<int*>::Inner3<int> id3; id3.f0(ip, i); - id3.f0(dp, i); // expected-error{{incompatible type}} + id3.f0(dp, i); // expected-error{{cannot initialize a parameter of type 'int *' with an lvalue of type 'double *'}} id3.f1(ip, i, ip); id3.f1(ip, i, dp); // expected-note{{instantiation}} diff --git a/test/SemaTemplate/instantiate-method.cpp b/test/SemaTemplate/instantiate-method.cpp index 231e2812f666..a02fe5238c35 100644 --- a/test/SemaTemplate/instantiate-method.cpp +++ b/test/SemaTemplate/instantiate-method.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> class X { public: @@ -79,7 +79,7 @@ template<class T> struct A1; int *a(A0<int> &x0, A1<int> &x1) { int *y0 = x0; - int *y1 = x1; // expected-error{{initializing}} + int *y1 = x1; // expected-error{{no viable conversion}} } struct X0Base { diff --git a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp index 32acbd0d8bdc..414e62b13a03 100644 --- a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp +++ b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR5311 template<typename T> diff --git a/test/SemaTemplate/instantiate-objc-1.mm b/test/SemaTemplate/instantiate-objc-1.mm index 093be4e27155..92d0d6c95080 100644 --- a/test/SemaTemplate/instantiate-objc-1.mm +++ b/test/SemaTemplate/instantiate-objc-1.mm @@ -1,4 +1,4 @@ -// RUN: clang -cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Obj-C string literal expressions template <typename T> struct StringTest { diff --git a/test/SemaTemplate/instantiate-overloaded-arrow.cpp b/test/SemaTemplate/instantiate-overloaded-arrow.cpp index 7f0ef0c990ad..ee36427db87b 100644 --- a/test/SemaTemplate/instantiate-overloaded-arrow.cpp +++ b/test/SemaTemplate/instantiate-overloaded-arrow.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR5488 struct X { diff --git a/test/SemaTemplate/instantiate-static-var.cpp b/test/SemaTemplate/instantiate-static-var.cpp index d4a7008b47bf..8a2f34d475a7 100644 --- a/test/SemaTemplate/instantiate-static-var.cpp +++ b/test/SemaTemplate/instantiate-static-var.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, T Divisor> class X { public: @@ -30,7 +30,7 @@ T Z<T>::value; // expected-error{{no matching constructor}} struct DefCon {}; struct NoDefCon { - NoDefCon(const NoDefCon&); + NoDefCon(const NoDefCon&); // expected-note{{candidate function}} }; void test() { diff --git a/test/SemaTemplate/instantiate-subscript.cpp b/test/SemaTemplate/instantiate-subscript.cpp index 20e2c39d0cce..a7187516da39 100644 --- a/test/SemaTemplate/instantiate-subscript.cpp +++ b/test/SemaTemplate/instantiate-subscript.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct Sub0 { diff --git a/test/SemaTemplate/instantiate-template-template-parm.cpp b/test/SemaTemplate/instantiate-template-template-parm.cpp index 30ba113e20d4..f48a0c7a7145 100644 --- a/test/SemaTemplate/instantiate-template-template-parm.cpp +++ b/test/SemaTemplate/instantiate-template-template-parm.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<template<typename T> class MetaFun, typename Value> struct apply { typedef typename MetaFun<Value>::type type; @@ -17,7 +17,7 @@ struct add_reference { int i; apply<add_pointer, int>::type ip = &i; apply<add_reference, int>::type ir = i; -apply<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a value of type 'int'}} +apply<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot bind to a value of unrelated type 'int'}} // Template template parameters template<int> struct B; // expected-note{{has a different type 'int'}} diff --git a/test/SemaTemplate/instantiate-try-catch.cpp b/test/SemaTemplate/instantiate-try-catch.cpp index 074afa9d173d..aa809e4bf949 100644 --- a/test/SemaTemplate/instantiate-try-catch.cpp +++ b/test/SemaTemplate/instantiate-try-catch.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s template<typename T> struct TryCatch0 { void f() { diff --git a/test/SemaTemplate/instantiate-type.cpp b/test/SemaTemplate/instantiate-type.cpp index 48060c4e384e..f5d02707cb1f 100644 --- a/test/SemaTemplate/instantiate-type.cpp +++ b/test/SemaTemplate/instantiate-type.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s int* f(int); float *f(...); diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp index e092b531582b..977fd08cc36d 100644 --- a/test/SemaTemplate/instantiate-typedef.cpp +++ b/test/SemaTemplate/instantiate-typedef.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct add_pointer { @@ -8,7 +8,7 @@ struct add_pointer { add_pointer<int>::type test1(int * ptr) { return ptr; } add_pointer<float>::type test2(int * ptr) { - return ptr; // expected-error{{incompatible type returning 'int *', expected 'add_pointer<float>::type' (aka 'float *')}} + return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}} } add_pointer<int&>::type // expected-note{{in instantiation of template class 'struct add_pointer<int &>' requested here}} \ diff --git a/test/SemaTemplate/instantiate-using-decl.cpp b/test/SemaTemplate/instantiate-using-decl.cpp index de66f79242fc..a4394aa21f6e 100644 --- a/test/SemaTemplate/instantiate-using-decl.cpp +++ b/test/SemaTemplate/instantiate-using-decl.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace test0 { namespace N { } @@ -47,3 +47,17 @@ namespace test1 { Knot().Visit((struct Object3*) 0); // expected-error {{no matching member function for call}} } } + +// PR5847 +namespace test2 { + namespace ns { + void foo(); + } + + template <class T> void bar(T* ptr) { + using ns::foo; + foo(); + } + + template void bar(char *); +} diff --git a/test/SemaTemplate/instantiation-backtrace.cpp b/test/SemaTemplate/instantiation-backtrace.cpp index 869662268dd2..93f9a3552aa0 100644 --- a/test/SemaTemplate/instantiation-backtrace.cpp +++ b/test/SemaTemplate/instantiation-backtrace.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct A; // expected-note 4{{template is declared here}} template<typename T> struct B : A<T*> { }; // expected-error{{implicit instantiation of undefined template}} \ diff --git a/test/SemaTemplate/instantiation-default-1.cpp b/test/SemaTemplate/instantiation-default-1.cpp index f0ce0d3cc669..6f5a660d99f1 100644 --- a/test/SemaTemplate/instantiation-default-1.cpp +++ b/test/SemaTemplate/instantiation-default-1.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, typename U = const T> struct Def1; template<> struct Def1<int> { diff --git a/test/SemaTemplate/instantiation-default-2.cpp b/test/SemaTemplate/instantiation-default-2.cpp index 4d9a0e2717bf..4d6756eca376 100644 --- a/test/SemaTemplate/instantiation-default-2.cpp +++ b/test/SemaTemplate/instantiation-default-2.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, T Value> struct Constant; // expected-note{{template parameter is declared here}} \ // FIXME: bad location expected-error{{a non-type template parameter cannot have type 'float'}} diff --git a/test/SemaTemplate/instantiation-default-3.cpp b/test/SemaTemplate/instantiation-default-3.cpp index 521edf66f24c..dae6b18f32c2 100644 --- a/test/SemaTemplate/instantiation-default-3.cpp +++ b/test/SemaTemplate/instantiation-default-3.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct A { }; diff --git a/test/SemaTemplate/instantiation-depth.cpp b/test/SemaTemplate/instantiation-depth.cpp index 31abb40dd5b1..f48ede9c44cf 100644 --- a/test/SemaTemplate/instantiation-depth.cpp +++ b/test/SemaTemplate/instantiation-depth.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -ftemplate-depth 5 -verify %s +// RUN: %clang_cc1 -fsyntax-only -ftemplate-depth 5 -verify %s template<typename T> struct X : X<T*> { }; // expected-error{{recursive template instantiation exceeded maximum depth of 5}} \ // expected-note{{use -ftemplate-depth-N to increase recursive template instantiation depth}} \ diff --git a/test/SemaTemplate/member-access-expr.cpp b/test/SemaTemplate/member-access-expr.cpp index ad0075f564b6..116e8377b366 100644 --- a/test/SemaTemplate/member-access-expr.cpp +++ b/test/SemaTemplate/member-access-expr.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> void call_f0(T x) { x.Base::f0(); @@ -105,3 +105,17 @@ void test_X5(X5<X4> x5, X5<const X4> x5c, X4 *xp, const X4 *cxp) { x5.f(xp); x5c.g(cxp); } + +// In theory we can do overload resolution at template-definition time on this. +// We should at least not assert. +namespace test4 { + struct Base { + template <class T> void foo() {} + }; + + template <class T> struct Foo : Base { + void test() { + foo<int>(); + } + }; +} diff --git a/test/SemaTemplate/member-function-template.cpp b/test/SemaTemplate/member-function-template.cpp index 1d46d31e35d3..5ea8c1010e5c 100644 --- a/test/SemaTemplate/member-function-template.cpp +++ b/test/SemaTemplate/member-function-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct X { template<typename T> T& f0(T); diff --git a/test/SemaTemplate/member-initializers.cpp b/test/SemaTemplate/member-initializers.cpp index 62077fabc721..40f56b34dae0 100644 --- a/test/SemaTemplate/member-initializers.cpp +++ b/test/SemaTemplate/member-initializers.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct A { A() : j(10), i(10) { } diff --git a/test/SemaTemplate/member-template-access-expr.cpp b/test/SemaTemplate/member-template-access-expr.cpp index 567c0d63b046..9edefe8b63e0 100644 --- a/test/SemaTemplate/member-template-access-expr.cpp +++ b/test/SemaTemplate/member-template-access-expr.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename U, typename T> U f0(T t) { return t.template get<U>(); diff --git a/test/SemaTemplate/metafun-apply.cpp b/test/SemaTemplate/metafun-apply.cpp index 471b2ad3fae6..bb3c88ad3957 100644 --- a/test/SemaTemplate/metafun-apply.cpp +++ b/test/SemaTemplate/metafun-apply.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct add_pointer { template<typename T> @@ -29,14 +29,12 @@ struct apply1 { int i; apply1<add_pointer, int>::type ip = &i; apply1<add_reference, int>::type ir = i; -apply1<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a value of type 'int'}} +apply1<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot bind to a value of unrelated type 'int'}} void test() { - apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}} \ - // FIXME: expected-error{{unexpected type name 'type': expected expression}} + apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}} - apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}} \ - // FIXME: expected-error{{unexpected type name 'type': expected expression}} + apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}} } diff --git a/test/SemaTemplate/nested-linkage.cpp b/test/SemaTemplate/nested-linkage.cpp index ffe9adc927d6..6c0791c2efc8 100644 --- a/test/SemaTemplate/nested-linkage.cpp +++ b/test/SemaTemplate/nested-linkage.cpp @@ -1,3 +1,3 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s extern "C" { extern "C++" { template<class C> C x(); } } diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp index 436732a828d7..704b8cfce128 100644 --- a/test/SemaTemplate/nested-name-spec-template.cpp +++ b/test/SemaTemplate/nested-name-spec-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace N { namespace M { diff --git a/test/SemaTemplate/nested-template.cpp b/test/SemaTemplate/nested-template.cpp index e18329c145d0..01ede32f9a08 100644 --- a/test/SemaTemplate/nested-template.cpp +++ b/test/SemaTemplate/nested-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s class A; class S { diff --git a/test/SemaTemplate/operator-function-id-template.cpp b/test/SemaTemplate/operator-function-id-template.cpp index 92a8c84e3be6..9a0884e8136d 100644 --- a/test/SemaTemplate/operator-function-id-template.cpp +++ b/test/SemaTemplate/operator-function-id-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct A { diff --git a/test/SemaTemplate/operator-template.cpp b/test/SemaTemplate/operator-template.cpp index dc44d04b6882..4300755cf711 100644 --- a/test/SemaTemplate/operator-template.cpp +++ b/test/SemaTemplate/operator-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Make sure we accept this template<class X>struct A{typedef X Y;}; diff --git a/test/SemaTemplate/overload-uneval.cpp b/test/SemaTemplate/overload-uneval.cpp index 2e3bfede700a..632d1cd521d9 100644 --- a/test/SemaTemplate/overload-uneval.cpp +++ b/test/SemaTemplate/overload-uneval.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Tests that overload resolution is treated as an unevaluated context. // PR5541 diff --git a/test/SemaTemplate/partial-spec-instantiate.cpp b/test/SemaTemplate/partial-spec-instantiate.cpp index 8d1ae238977c..3156892a7234 100644 --- a/test/SemaTemplate/partial-spec-instantiate.cpp +++ b/test/SemaTemplate/partial-spec-instantiate.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s // PR4607 template <class T> struct X {}; diff --git a/test/SemaTemplate/qualified-id.cpp b/test/SemaTemplate/qualified-id.cpp index ab57950acff2..655a80e2bfbf 100644 --- a/test/SemaTemplate/qualified-id.cpp +++ b/test/SemaTemplate/qualified-id.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR5061 namespace a { diff --git a/test/SemaTemplate/qualified-names-diag.cpp b/test/SemaTemplate/qualified-names-diag.cpp index 1d53e5cb98ba..b2df47bfff4c 100644 --- a/test/SemaTemplate/qualified-names-diag.cpp +++ b/test/SemaTemplate/qualified-names-diag.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace std { template<typename T> class vector { }; // expected-note{{candidate}} diff --git a/test/SemaTemplate/recursive-template-instantiation.cpp b/test/SemaTemplate/recursive-template-instantiation.cpp index 7c88d5019fd5..0ddedaf2354a 100644 --- a/test/SemaTemplate/recursive-template-instantiation.cpp +++ b/test/SemaTemplate/recursive-template-instantiation.cpp @@ -1,6 +1,6 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s -template<typename T> void f(T* t) { +template<typename T> void f(T* t) { // expected-note{{candidate function}} f(*t); // expected-error{{no matching function}}\ // expected-note 3{{requested here}} } diff --git a/test/SemaTemplate/temp.cpp b/test/SemaTemplate/temp.cpp index 8be4739a741b..961b9c873ab8 100644 --- a/test/SemaTemplate/temp.cpp +++ b/test/SemaTemplate/temp.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // p3 diff --git a/test/SemaTemplate/temp_arg.cpp b/test/SemaTemplate/temp_arg.cpp index e873b8e2a61d..3c9fcb506610 100644 --- a/test/SemaTemplate/temp_arg.cpp +++ b/test/SemaTemplate/temp_arg.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, int I, template<typename> class TT> diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 0c44651ccfee..133b8db9491a 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -std=c++98 -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s template<int N> struct A; // expected-note 5{{template parameter is declared here}} A<0> *a0; @@ -105,13 +105,23 @@ A7c<(&Z::int_member)> *a18_3; // expected-error{{non-type template argument cann template<unsigned char C> struct Overflow; // expected-note{{template parameter is declared here}} Overflow<5> *overflow1; // okay -Overflow<256> *overflow2; // expected-error{{non-type template argument value '256' is too large for template parameter of type 'unsigned char'}} +Overflow<255> *overflow2; // okay +Overflow<256> *overflow3; // expected-error{{non-type template argument value '256' is too large for template parameter of type 'unsigned char'}} template<unsigned> struct Signedness; // expected-note{{template parameter is declared here}} Signedness<10> *signedness1; // okay Signedness<-10> *signedness2; // expected-error{{non-type template argument provides negative value '-10' for unsigned template parameter of type 'unsigned int'}} +template<signed char C> struct SignedOverflow; // expected-note 3 {{template parameter is declared here}} +SignedOverflow<1> *signedoverflow1; +SignedOverflow<-1> *signedoverflow2; +SignedOverflow<-128> *signedoverflow3; +SignedOverflow<-129> *signedoverflow4; // expected-error{{non-type template argument value '-129' is too large for template parameter of type 'signed char'}} +SignedOverflow<127> *signedoverflow5; +SignedOverflow<128> *signedoverflow6; // expected-error{{non-type template argument value '128' is too large for template parameter of type 'signed char'}} +SignedOverflow<(unsigned char)128> *signedoverflow7; // expected-error{{non-type template argument value '128' is too large for template parameter of type 'signed char'}} + // Check canonicalization of template arguments. template<int (*)(int, int)> struct FuncPtr0; int func0(int, int); diff --git a/test/SemaTemplate/temp_arg_template.cpp b/test/SemaTemplate/temp_arg_template.cpp index ada244bb5de6..667122583fda 100644 --- a/test/SemaTemplate/temp_arg_template.cpp +++ b/test/SemaTemplate/temp_arg_template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<template<typename T> class X> struct A; // expected-note 2{{previous template template parameter is here}} diff --git a/test/SemaTemplate/temp_arg_type.cpp b/test/SemaTemplate/temp_arg_type.cpp index b322dae98b90..a376900666d8 100644 --- a/test/SemaTemplate/temp_arg_type.cpp +++ b/test/SemaTemplate/temp_arg_type.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> class A; // expected-note 2 {{template parameter is declared here}} // [temp.arg.type]p1 diff --git a/test/SemaTemplate/temp_class_order.cpp b/test/SemaTemplate/temp_class_order.cpp index 4687ddf7d9e9..fcf0325b7bbc 100644 --- a/test/SemaTemplate/temp_class_order.cpp +++ b/test/SemaTemplate/temp_class_order.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, typename U> struct X1 { diff --git a/test/SemaTemplate/temp_class_spec.cpp b/test/SemaTemplate/temp_class_spec.cpp index dad857e8e66d..48026f913178 100644 --- a/test/SemaTemplate/temp_class_spec.cpp +++ b/test/SemaTemplate/temp_class_spec.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct is_pointer { static const bool value = false; diff --git a/test/SemaTemplate/temp_class_spec_blocks.cpp b/test/SemaTemplate/temp_class_spec_blocks.cpp index 920d9c8b0cbd..b7b96df69ba5 100644 --- a/test/SemaTemplate/temp_class_spec_blocks.cpp +++ b/test/SemaTemplate/temp_class_spec_blocks.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s -fblocks +// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks template<typename T> struct is_unary_block { static const bool value = false; diff --git a/test/SemaTemplate/temp_class_spec_neg.cpp b/test/SemaTemplate/temp_class_spec_neg.cpp index a029f474fc58..c8e8a57f278b 100644 --- a/test/SemaTemplate/temp_class_spec_neg.cpp +++ b/test/SemaTemplate/temp_class_spec_neg.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> struct vector; // C++ [temp.class.spec]p6: diff --git a/test/SemaTemplate/temp_explicit.cpp b/test/SemaTemplate/temp_explicit.cpp index ae409aff662b..fbb41ff601a3 100644 --- a/test/SemaTemplate/temp_explicit.cpp +++ b/test/SemaTemplate/temp_explicit.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s // // Tests explicit instantiation of templates. template<typename T, typename U = T> class X0 { }; diff --git a/test/SemaTemplate/temp_explicit_cxx0x.cpp b/test/SemaTemplate/temp_explicit_cxx0x.cpp index 7045afc3032f..215d2cfa0820 100644 --- a/test/SemaTemplate/temp_explicit_cxx0x.cpp +++ b/test/SemaTemplate/temp_explicit_cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s namespace N1 { template<typename T> struct X0 { }; // expected-note{{here}} diff --git a/test/SemaTemplate/temp_func_order.cpp b/test/SemaTemplate/temp_func_order.cpp index 5fd7c8d74571..908354b58ed2 100644 --- a/test/SemaTemplate/temp_func_order.cpp +++ b/test/SemaTemplate/temp_func_order.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> int &f0(T); diff --git a/test/SemaTemplate/template-class-traits.cpp b/test/SemaTemplate/template-class-traits.cpp index 7cf2004e727f..471029445256 100644 --- a/test/SemaTemplate/template-class-traits.cpp +++ b/test/SemaTemplate/template-class-traits.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s #define T(b) (b) ? 1 : -1 #define F(b) (b) ? -1 : 1 diff --git a/test/SemaTemplate/template-decl-fail.cpp b/test/SemaTemplate/template-decl-fail.cpp index b136f6279d52..a298c6d5a4ba 100644 --- a/test/SemaTemplate/template-decl-fail.cpp +++ b/test/SemaTemplate/template-decl-fail.cpp @@ -1,3 +1,3 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> typedef T X; // expected-error{{typedef cannot be a template}} diff --git a/test/SemaTemplate/template-id-expr.cpp b/test/SemaTemplate/template-id-expr.cpp index dd8694afa7ea..70a1062c2287 100644 --- a/test/SemaTemplate/template-id-expr.cpp +++ b/test/SemaTemplate/template-id-expr.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR5336 template<typename FromCl> struct isa_impl_cl { diff --git a/test/SemaTemplate/template-id-printing.cpp b/test/SemaTemplate/template-id-printing.cpp index 13250943e92c..fcd4974a7611 100644 --- a/test/SemaTemplate/template-id-printing.cpp +++ b/test/SemaTemplate/template-id-printing.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fsyntax-only -ast-print %s | FileCheck %s namespace N { template<typename T, typename U> void f(U); template<int> void f(); diff --git a/test/SemaTemplate/typename-specifier-2.cpp b/test/SemaTemplate/typename-specifier-2.cpp index 99e628523158..551cac3168b2 100644 --- a/test/SemaTemplate/typename-specifier-2.cpp +++ b/test/SemaTemplate/typename-specifier-2.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename MetaFun, typename T> struct bind_metafun { @@ -18,7 +18,7 @@ int i; // 'aka' telling us that we're dealing with an int**. Should we fix // getDesugaredType to dig through pointers and such? bind_metafun<add_pointer, int>::type::type ip = &i; -bind_metafun<add_pointer, float>::type::type fp = &i; // expected-error{{incompatible type initializing 'int *', expected 'bind_metafun<add_pointer, float>::type::type' (aka 'float *')}} +bind_metafun<add_pointer, float>::type::type fp = &i; // expected-error{{cannot initialize a variable of type 'bind_metafun<add_pointer, float>::type::type' (aka 'float *') with an rvalue of type 'int *'}} template<typename T> diff --git a/test/SemaTemplate/typename-specifier-3.cpp b/test/SemaTemplate/typename-specifier-3.cpp index 8dde6095e533..a463d88752c9 100644 --- a/test/SemaTemplate/typename-specifier-3.cpp +++ b/test/SemaTemplate/typename-specifier-3.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR4364 template<class T> struct a { diff --git a/test/SemaTemplate/typename-specifier-4.cpp b/test/SemaTemplate/typename-specifier-4.cpp index c7484c19fca7..7fd88f130fa6 100644 --- a/test/SemaTemplate/typename-specifier-4.cpp +++ b/test/SemaTemplate/typename-specifier-4.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T, typename U> struct is_same { static const bool value = false; diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp index 2501b8d048ff..b968ea6ad544 100644 --- a/test/SemaTemplate/typename-specifier.cpp +++ b/test/SemaTemplate/typename-specifier.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace N { struct A { typedef int type; diff --git a/test/SemaTemplate/value-dependent-null-pointer-constant.cpp b/test/SemaTemplate/value-dependent-null-pointer-constant.cpp index 110c380c9aa2..223500eac48c 100644 --- a/test/SemaTemplate/value-dependent-null-pointer-constant.cpp +++ b/test/SemaTemplate/value-dependent-null-pointer-constant.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s template<typename T, int N> struct X0 { diff --git a/test/SemaTemplate/variadic-class-template-1.cpp b/test/SemaTemplate/variadic-class-template-1.cpp index 6df905006692..6da64fb55f70 100644 --- a/test/SemaTemplate/variadic-class-template-1.cpp +++ b/test/SemaTemplate/variadic-class-template-1.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x template<typename ... Args = int> struct S1 { }; // expected-error{{template parameter pack cannot have a default argument}} template<typename ... Args, typename T> struct S2 { }; // expected-error{{template parameter pack must be the last template parameter}} diff --git a/test/SemaTemplate/variadic-class-template-2.cpp b/test/SemaTemplate/variadic-class-template-2.cpp index b1ac71b88bda..509977121f4b 100644 --- a/test/SemaTemplate/variadic-class-template-2.cpp +++ b/test/SemaTemplate/variadic-class-template-2.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x // Type parameters packs template <typename ...> struct TS1 {}; // expected-note{{template parameter is declared here}} diff --git a/test/SemaTemplate/variadic-parse.cpp b/test/SemaTemplate/variadic-parse.cpp index e1d1b1f98db2..d8b77b3f423e 100644 --- a/test/SemaTemplate/variadic-parse.cpp +++ b/test/SemaTemplate/variadic-parse.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x // Parsing type parameter packs. template <typename ... Args> struct T1 {}; diff --git a/test/SemaTemplate/variadic-unsupported.cpp b/test/SemaTemplate/variadic-unsupported.cpp index 98f217c76891..9f2b0807d2d6 100644 --- a/test/SemaTemplate/variadic-unsupported.cpp +++ b/test/SemaTemplate/variadic-unsupported.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Type parameter packs. template <typename ... > struct T1 {}; // expected-error{{variadic templates are only allowed in C++0x}} diff --git a/test/SemaTemplate/virtual-member-functions.cpp b/test/SemaTemplate/virtual-member-functions.cpp index 486c8b205141..69ae0807b4c5 100644 --- a/test/SemaTemplate/virtual-member-functions.cpp +++ b/test/SemaTemplate/virtual-member-functions.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace PR5557 { template <class T> struct A { |