diff options
Diffstat (limited to 'test/SemaTemplate')
32 files changed, 357 insertions, 40 deletions
diff --git a/test/SemaTemplate/alias-church-numerals.cpp b/test/SemaTemplate/alias-church-numerals.cpp index 751cac73ae0f..69d77163ab67 100644 --- a/test/SemaTemplate/alias-church-numerals.cpp +++ b/test/SemaTemplate/alias-church-numerals.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<template<template<typename> class, typename> class T, template<typename> class V> struct PartialApply { template<typename W> using R = T<V, W>; diff --git a/test/SemaTemplate/alias-nested-nontag.cpp b/test/SemaTemplate/alias-nested-nontag.cpp index 1bb5ce336f90..4b5226b26ebb 100644 --- a/test/SemaTemplate/alias-nested-nontag.cpp +++ b/test/SemaTemplate/alias-nested-nontag.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template<typename T> using Id = T; // expected-note {{type alias template 'Id' declared here}} struct U { static Id<int> V; }; diff --git a/test/SemaTemplate/alias-template-template-param.cpp b/test/SemaTemplate/alias-template-template-param.cpp index a847b0672a2a..c22fccb6788e 100644 --- a/test/SemaTemplate/alias-template-template-param.cpp +++ b/test/SemaTemplate/alias-template-template-param.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template<template<typename> class D> using C = D<int>; diff --git a/test/SemaTemplate/alias-templates.cpp b/test/SemaTemplate/alias-templates.cpp index f4c917c5ebc2..79d6849a6efe 100644 --- a/test/SemaTemplate/alias-templates.cpp +++ b/test/SemaTemplate/alias-templates.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename S> struct A { diff --git a/test/SemaTemplate/atomics.cpp b/test/SemaTemplate/atomics.cpp new file mode 100644 index 000000000000..7165bbe591e9 --- /dev/null +++ b/test/SemaTemplate/atomics.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR8345 +template<typename T> T f(T* value) { + return __sync_add_and_fetch(value, 1); +} +int g(long long* x) { return f(x); } +int g(int* x) { return f(x); } diff --git a/test/SemaTemplate/attributes.cpp b/test/SemaTemplate/attributes.cpp index e208bd2b8990..495f4a7ad389 100644 --- a/test/SemaTemplate/attributes.cpp +++ b/test/SemaTemplate/attributes.cpp @@ -19,3 +19,16 @@ namespace attribute_aligned { check_alignment<3>::t c3; // expected-note 2 {{in instantiation}} check_alignment<4>::t c4; } + +namespace PR9049 { + extern const void *CFRetain(const void *ref); + + template<typename T> __attribute__((cf_returns_retained)) + inline T WBCFRetain(T aValue) { return aValue ? (T)CFRetain(aValue) : (T)0; } + + + extern void CFRelease(const void *ref); + + template<typename T> + inline void WBCFRelease(__attribute__((cf_consumed)) T aValue) { if(aValue) CFRelease(aValue); } +} diff --git a/test/SemaTemplate/canonical-expr-type-0x.cpp b/test/SemaTemplate/canonical-expr-type-0x.cpp index 73cf3c29665c..94ae360b43ef 100644 --- a/test/SemaTemplate/canonical-expr-type-0x.cpp +++ b/test/SemaTemplate/canonical-expr-type-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s void f(); diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp index fe7213f14385..ccef811e2224 100644 --- a/test/SemaTemplate/current-instantiation.cpp +++ b/test/SemaTemplate/current-instantiation.cpp @@ -215,3 +215,23 @@ namespace PR9255 { }; }; } + +namespace rdar10194295 { + template<typename XT> + class X { + public: + enum Enum { Yes, No }; + template<Enum> void foo(); + template<Enum> class Inner; + }; + + template<typename XT> + template<typename X<XT>::Enum> + void X<XT>::foo() + { + } + + template<typename XT> + template<typename X<XT>::Enum> + class X<XT>::Inner { }; +} diff --git a/test/SemaTemplate/default-arguments-cxx0x.cpp b/test/SemaTemplate/default-arguments-cxx0x.cpp index 0f7ba4678b8e..77143136c3d2 100644 --- a/test/SemaTemplate/default-arguments-cxx0x.cpp +++ b/test/SemaTemplate/default-arguments-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s // Test default template arguments for function templates. template<typename T = int> diff --git a/test/SemaTemplate/delegating-constructors.cpp b/test/SemaTemplate/delegating-constructors.cpp new file mode 100644 index 000000000000..d82343402b74 --- /dev/null +++ b/test/SemaTemplate/delegating-constructors.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify + +namespace PR10457 { + + class string + { + string(const char* str, unsigned); + + public: + template <unsigned N> + string(const char (&str)[N]) + : string(str) {} // expected-error{{constructor for 'string<6>' creates a delegation cycle}} + }; + + void f() { + string s("hello"); + } +} diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp index 7bab5d18d1ad..36e1ad8f17f0 100644 --- a/test/SemaTemplate/dependent-names.cpp +++ b/test/SemaTemplate/dependent-names.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s typedef double A; template<typename T> class B { diff --git a/test/SemaTemplate/instantiate-array.cpp b/test/SemaTemplate/instantiate-array.cpp index 97ea6cbb8e53..b8229d3f641a 100644 --- a/test/SemaTemplate/instantiate-array.cpp +++ b/test/SemaTemplate/instantiate-array.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 #ifndef __GXX_EXPERIMENTAL_CXX0X__ #define __CONCAT(__X, __Y) __CONCAT1(__X, __Y) diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp index 7af59fd2d11b..896437488d68 100644 --- a/test/SemaTemplate/instantiate-expr-1.cpp +++ b/test/SemaTemplate/instantiate-expr-1.cpp @@ -170,3 +170,16 @@ namespace PR6424 { template void Y2<3>::f(); } + +namespace PR10864 { + template<typename T> class Vals {}; + template<> class Vals<int> { public: static const int i = 1; }; + template<> class Vals<float> { public: static const double i; }; + template<typename T> void test_asm_tied(T o) { + __asm("addl $1, %0" : "=r" (o) : "0"(Vals<T>::i)); // expected-error {{input with type 'double' matching output with type 'float'}} + } + void test_asm_tied() { + test_asm_tied(1); + test_asm_tied(1.f); // expected-note {{instantiation of}} + } +} diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp index 521d2180d7ab..9483f9b28366 100644 --- a/test/SemaTemplate/instantiate-expr-4.cpp +++ b/test/SemaTemplate/instantiate-expr-4.cpp @@ -135,6 +135,23 @@ namespace PR5755 { } } +namespace PR10480 { + template<typename T> + struct X { + X(); + ~X() { + T *ptr = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} + } + }; + + template<typename T> + void f() { + new X<int>[1]; // expected-note{{in instantiation of member function 'PR10480::X<int>::~X' requested here}} + } + + template void f<int>(); +} + // --------------------------------------------------------------------- // throw expressions // --------------------------------------------------------------------- diff --git a/test/SemaTemplate/instantiate-expr-basic.cpp b/test/SemaTemplate/instantiate-expr-basic.cpp index 074fe6941490..a266a6584b06 100644 --- a/test/SemaTemplate/instantiate-expr-basic.cpp +++ b/test/SemaTemplate/instantiate-expr-basic.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++11 %s template <typename T> struct S { diff --git a/test/SemaTemplate/instantiate-function-2.cpp b/test/SemaTemplate/instantiate-function-2.cpp index 087ede2b89cb..19a8b61ff193 100644 --- a/test/SemaTemplate/instantiate-function-2.cpp +++ b/test/SemaTemplate/instantiate-function-2.cpp @@ -46,7 +46,7 @@ namespace PR9654 { namespace AliasTagDef { template<typename T> T f() { - using S = struct { // expected-warning {{C++0x}} + using S = struct { // expected-warning {{C++11}} T g() { return T(); } diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp index 1028b45cc0e1..c67eb4022a47 100644 --- a/test/SemaTemplate/instantiate-member-class.cpp +++ b/test/SemaTemplate/instantiate-member-class.cpp @@ -108,7 +108,7 @@ namespace test2 { namespace AliasTagDef { template<typename T> struct F { - using S = struct U { // expected-warning {{C++0x}} + using S = struct U { // expected-warning {{C++11}} T g() { return T(); } diff --git a/test/SemaTemplate/instantiate-static-var.cpp b/test/SemaTemplate/instantiate-static-var.cpp index 0c0607524834..d2b0459ccc58 100644 --- a/test/SemaTemplate/instantiate-static-var.cpp +++ b/test/SemaTemplate/instantiate-static-var.cpp @@ -11,7 +11,7 @@ X<int, 0> xi0; // expected-note{{in instantiation of template class 'X<int, 0>' template<typename T> class Y { - static const T value = 0; // expected-warning{{in-class initializer for static data member of type 'const float' is a C++0x extension}} + static const T value = 0; // expected-warning{{in-class initializer for static data member of type 'const float' is a GNU extension}} }; Y<float> fy; // expected-note{{in instantiation of template class 'Y<float>' requested here}} diff --git a/test/SemaTemplate/instantiate-try-catch.cpp b/test/SemaTemplate/instantiate-try-catch.cpp index f4ce0e173146..89cae03af08f 100644 --- a/test/SemaTemplate/instantiate-try-catch.cpp +++ b/test/SemaTemplate/instantiate-try-catch.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -std=c++11 -verify %s template<typename T> struct TryCatch0 { void f() { diff --git a/test/SemaTemplate/lookup-dependent-bases.cpp b/test/SemaTemplate/lookup-dependent-bases.cpp new file mode 100644 index 000000000000..2710caf22125 --- /dev/null +++ b/test/SemaTemplate/lookup-dependent-bases.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s + +class C { +public: + static void foo2() { } +}; +template <class T> +class A { +public: + typedef C D; +}; + +template <class T> +class B : public A<T> { +public: + void foo() { + D::foo2(); + } +}; diff --git a/test/SemaTemplate/member-inclass-init-value-dependent.cpp b/test/SemaTemplate/member-inclass-init-value-dependent.cpp index d1ae4f2ded5f..5bff7f209579 100644 --- a/test/SemaTemplate/member-inclass-init-value-dependent.cpp +++ b/test/SemaTemplate/member-inclass-init-value-dependent.cpp @@ -9,3 +9,10 @@ void test() { foo<4> bar; } +struct S { + S(int n); +}; +template<typename> struct T { + S s = 0; +}; +T<int> t; diff --git a/test/SemaTemplate/missing-class-keyword-crash.cpp b/test/SemaTemplate/missing-class-keyword-crash.cpp new file mode 100644 index 000000000000..f0eee2ba2f8a --- /dev/null +++ b/test/SemaTemplate/missing-class-keyword-crash.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +class G {}; +template <Foo> // expected-error{{unknown type name 'Foo'}} \ + // expected-note{{template parameter is declared here}} +class Bar {}; + +class Bar<G> blah_test; // expected-error{{template argument for non-type template parameter must be an expression}} diff --git a/test/SemaTemplate/ms-function-specialization-class-scope.cpp b/test/SemaTemplate/ms-function-specialization-class-scope.cpp new file mode 100644 index 000000000000..bda87f99c9a1 --- /dev/null +++ b/test/SemaTemplate/ms-function-specialization-class-scope.cpp @@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s + + +class A { +public: + template <class U> + A(U p) { + } + template <> + A(int p) { // expected-warning{{explicit specialization of 'A' within class scope is a Microsoft extension}} + } + + template <class U> + void f(U p) { + } + + template <> + void f(int p) { // expected-warning{{explicit specialization of 'f' within class scope is a Microsoft extension}} + } + + void f(int p) { + } +}; + +void test1() +{ + A a(3); + char* b ; + a.f(b); + a.f<int>(99); + a.f(100); +} + + + + +template <class T> +class B { +public: + template <class U> + B(U p) { + } + template <> + B(int p) { // expected-warning{{explicit specialization of 'B<T>' within class scope is a Microsoft extension}} + } + + template <class U> + void f(U p) { + T y = 9; + } + + + template <> + void f(int p) { // expected-warning{{explicit specialization of 'f' within class scope is a Microsoft extension}} + T a = 3; + } + + void f(int p) { + T a = 3; + } +}; + +void test2() +{ + B<char> b(3); + char* ptr; + b.f(ptr); + b.f<int>(99); + b.f(100); +} + diff --git a/test/SemaTemplate/ms-lookup-template-base-classes.cpp b/test/SemaTemplate/ms-lookup-template-base-classes.cpp new file mode 100644 index 000000000000..910fa37e80d8 --- /dev/null +++ b/test/SemaTemplate/ms-lookup-template-base-classes.cpp @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s + + +template <class T> +class A { +public: + void f(T a) { }// expected-note {{must qualify identifier to find this declaration in dependent base class}} + void g();// expected-note {{must qualify identifier to find this declaration in dependent base class}} +}; + + +template <class T> +class B : public A<T> { +public: + void z(T a) + { + f(a); // expected-warning {{use of identifier 'f' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} + g(); // expected-warning {{use of identifier 'g' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} + } +}; + +template class B<int>; // expected-note {{requested here}} +template class B<char>; + +void test() +{ + B<int> b; + b.z(3); +} + + diff --git a/test/SemaTemplate/nested-template.cpp b/test/SemaTemplate/nested-template.cpp index 01ede32f9a08..ab647aa22675 100644 --- a/test/SemaTemplate/nested-template.cpp +++ b/test/SemaTemplate/nested-template.cpp @@ -125,4 +125,20 @@ X2<int>::Inner<X2_arg> x2i1; X2<float> x2a; // expected-note{{instantiation}} X2<long>::Inner<X2_arg> x2i3; // expected-error{{template template argument has different}} +namespace PR10896 { + template<typename TN> + class Foo { + + public: + void foo() {} + private: + + template<typename T> + T SomeField; // expected-error {{member 'SomeField' declared as a template}} + }; + void g() { + Foo<int> f; + f.foo(); + } +} diff --git a/test/SemaTemplate/operator-template.cpp b/test/SemaTemplate/operator-template.cpp index 4300755cf711..777b0f5f42a1 100644 --- a/test/SemaTemplate/operator-template.cpp +++ b/test/SemaTemplate/operator-template.cpp @@ -2,7 +2,8 @@ // Make sure we accept this template<class X>struct A{typedef X Y;}; -template<class X>bool operator==(A<X>,typename A<X>::Y); +template<class X>bool operator==(A<X>,typename A<X>::Y); // expected-note{{candidate template ignored: failed template argument deduction}} + int a(A<int> x) { return operator==(x,1); } int a0(A<int> x) { return x == 1; } @@ -10,7 +11,8 @@ int a0(A<int> x) { return x == 1; } // FIXME: the location information for the note isn't very good template<class X>struct B{typedef X Y;}; template<class X>bool operator==(B<X>*,typename B<X>::Y); // \ -expected-error{{overloaded 'operator==' must have at least one parameter of class or enumeration type}} \ -expected-note{{in instantiation of function template specialization}} -int a(B<int> x) { return operator==(&x,1); } +// expected-error{{overloaded 'operator==' must have at least one parameter of class or enumeration type}} \ +// expected-note{{in instantiation of function template specialization}} \ +// expected-note{{candidate template ignored: substitution failure [with X = int]}} +int a(B<int> x) { return operator==(&x,1); } // expected-error{{no matching function for call to 'operator=='}} diff --git a/test/SemaTemplate/overload-uneval.cpp b/test/SemaTemplate/overload-uneval.cpp index 632d1cd521d9..8d8a2f42cf28 100644 --- a/test/SemaTemplate/overload-uneval.cpp +++ b/test/SemaTemplate/overload-uneval.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused %s // Tests that overload resolution is treated as an unevaluated context. // PR5541 diff --git a/test/SemaTemplate/resolve-single-template-id.cpp b/test/SemaTemplate/resolve-single-template-id.cpp index ef0a76307670..b9833d8609ef 100644 --- a/test/SemaTemplate/resolve-single-template-id.cpp +++ b/test/SemaTemplate/resolve-single-template-id.cpp @@ -1,15 +1,15 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s namespace std { class type_info {}; } void one() { } -void two() { } // expected-note 3{{candidate}} -void two(int) { } // expected-note 3{{candidate}} +void two() { } // expected-note 4{{possible target for call}} +void two(int) { } // expected-note 4{{possible target for call}} -template<class T> void twoT() { } // expected-note 5{{candidate}} -template<class T> void twoT(int) { } // expected-note 5{{candidate}} +template<class T> void twoT() { } // expected-note 5{{possible target for call}} +template<class T> void twoT(int) { } // expected-note 5{{possible target for call}} template<class T> void oneT() { } template<class T, class U> void oneT(U) { } @@ -29,29 +29,30 @@ template<void (*p)(int)> struct test { }; int main() { one; // expected-warning {{expression result unused}} - two; // expected-error {{cannot resolve overloaded function 'two' from context}} + two; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} oneT<int>; // expected-warning {{expression result unused}} - twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}} + twoT<int>; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} typeid(oneT<int>); // expected-warning{{expression result unused}} sizeof(oneT<int>); // expected-warning {{expression result unused}} - sizeof(twoT<int>); //expected-error {{cannot resolve overloaded function 'twoT' from context}} + sizeof(twoT<int>); //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} decltype(oneT<int>)* fun = 0; *one; // expected-warning {{expression result unused}} *oneT<int>; // expected-warning {{expression result unused}} - *two; //expected-error {{cannot resolve overloaded function 'two' from context}} - *twoT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}} + *two; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{indirection requires pointer operand}} + *twoT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} !oneT<int>; // expected-warning {{expression result unused}} +oneT<int>; // expected-warning {{expression result unused}} -oneT<int>; //expected-error {{invalid argument type}} - oneT<int> == 0; // expected-warning {{expression result unused}} - 0 == oneT<int>; // expected-warning {{expression result unused}} - 0 != oneT<int>; // expected-warning {{expression result unused}} + oneT<int> == 0; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + 0 == oneT<int>; // expected-warning {{equality comparison result unused}} + 0 != oneT<int>; // expected-warning {{inequality comparison result unused}} (false ? one : oneT<int>); // expected-warning {{expression result unused}} void (*p1)(int); p1 = oneT<int>; int i = (int) (false ? (void (*)(int))twoT<int> : oneT<int>); //expected-error {{incompatible operand}} - (twoT<int>) == oneT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}} + (twoT<int>) == oneT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} {{cannot resolve overloaded function 'twoT' from context}} bool b = oneT<int>; void (*p)() = oneT<int>; test<oneT<int> > ti; @@ -65,9 +66,10 @@ int main() oneT<int> < oneT<int>; //expected-warning {{self-comparison always evaluates to false}} \ //expected-warning {{expression result unused}} - two < two; //expected-error {{cannot resolve overloaded function 'two' from context}} - twoT<int> < twoT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}} - oneT<int> == 0; // expected-warning {{expression result unused}} + two < two; //expected-error 2 {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{invalid operands to binary expression ('void' and 'void')}} + twoT<int> < twoT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} {{cannot resolve overloaded function 'twoT' from context}} + oneT<int> == 0; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} } @@ -76,5 +78,5 @@ struct rdar9108698 { }; void test_rdar9108698(rdar9108698 x) { - x.f<int>; // expected-error{{a bound member function may only be called}} + x.f<int>; // expected-error{{reference to non-static member function must be called}} } diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 5be5a1303136..747ddcc4618e 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -7,7 +7,7 @@ A<int()> *a1; // expected-error{{template argument for non-type template paramet A<int> *a2; // expected-error{{template argument for non-type template parameter must be an expression}} -A<1 >> 2> *a3; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++0x}} +A<1 >> 2> *a3; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++11}} // C++ [temp.arg.nontype]p5: A<A> *a4; // expected-error{{must be an expression}} @@ -170,7 +170,7 @@ namespace pr6249 { namespace PR6723 { template<unsigned char C> void f(int (&a)[C]); // expected-note {{candidate template ignored}} \ - // expected-note{{candidate function [with C = '\x00'] not viable: no known conversion from 'int [512]' to 'int (&)[0]' for 1st argument}} + // expected-note{{substitution failure [with C = '\x00']}} void g() { int arr512[512]; f(arr512); // expected-error{{no matching function for call}} @@ -263,3 +263,63 @@ namespace PR9227 { void test_char_single_quote() { enable_if_char<'\''>::type i; } // expected-error{{enable_if_char<'\''>}} void test_char_backslash() { enable_if_char<'\\'>::type i; } // expected-error{{enable_if_char<'\\'>}} } + +namespace PR10579 { + namespace fcppt + { + namespace container + { + namespace bitfield + { + + template< + typename Enum, + Enum Size + > + class basic; + + template< + typename Enum, + Enum Size + > + class basic + { + public: + basic() + { + } + }; + + } + } + } + + namespace + { + + namespace testenum + { + enum type + { + foo, + bar, + size + }; + } + + } + + int main() + { + typedef fcppt::container::bitfield::basic< + testenum::type, + testenum::size + > bitfield_foo; + + bitfield_foo obj; + } + +} + +template <int& I> struct PR10766 { static int *ip; }; +template <int& I> int* PR10766<I>::ip = &I; diff --git a/test/SemaTemplate/temp_explicit_cxx0x.cpp b/test/SemaTemplate/temp_explicit_cxx0x.cpp index 215d2cfa0820..9d6dc80b5b0a 100644 --- a/test/SemaTemplate/temp_explicit_cxx0x.cpp +++ b/test/SemaTemplate/temp_explicit_cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s namespace N1 { template<typename T> struct X0 { }; // expected-note{{here}} diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp index 7898a20d6e17..9eb4f33de0b9 100644 --- a/test/SemaTemplate/typename-specifier.cpp +++ b/test/SemaTemplate/typename-specifier.cpp @@ -102,3 +102,16 @@ struct H { }; G<H> struct_G; + +namespace PR10925 { + template< int mydim, typename Traits > + class BasicGeometry + { + typedef int some_type_t; + }; + + template<class ctype, int mydim, int coorddim> + class MockGeometry : BasicGeometry<mydim, int>{ + using typename BasicGeometry<mydim, int>::operator[]; // expected-error {{typename is allowed for identifiers only}} + }; +} diff --git a/test/SemaTemplate/unresolved-construct.cpp b/test/SemaTemplate/unresolved-construct.cpp index 0d1ba17a0179..bb9ed8e4e081 100644 --- a/test/SemaTemplate/unresolved-construct.cpp +++ b/test/SemaTemplate/unresolved-construct.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s class A { public: |