summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaTemplate')
-rw-r--r--clang/test/SemaTemplate/class-template-spec.cpp10
-rw-r--r--clang/test/SemaTemplate/ext_ms_template_spec.cpp8
-rw-r--r--clang/test/SemaTemplate/function-template-specialization.cpp2
-rw-r--r--clang/test/SemaTemplate/instantiate-method.cpp2
-rw-r--r--clang/test/SemaTemplate/ms-function-specialization-class-scope.cpp24
-rw-r--r--clang/test/SemaTemplate/temp_class_spec_neg.cpp6
6 files changed, 16 insertions, 36 deletions
diff --git a/clang/test/SemaTemplate/class-template-spec.cpp b/clang/test/SemaTemplate/class-template-spec.cpp
index 00e03ef61eb..d763944371c 100644
--- a/clang/test/SemaTemplate/class-template-spec.cpp
+++ b/clang/test/SemaTemplate/class-template-spec.cpp
@@ -78,9 +78,6 @@ template<> struct ::A<double>;
namespace N {
template<typename T> struct B; // expected-note {{explicitly specialized}}
-#if __cplusplus <= 199711L
- // expected-note@-2 {{explicitly specialized}}
-#endif
template<> struct ::N::B<char>; // okay
template<> struct ::N::B<short>; // okay
@@ -92,9 +89,6 @@ namespace N {
template<> struct N::B<int> { }; // okay
template<> struct N::B<float> { };
-#if __cplusplus <= 199711L
-// expected-warning@-2 {{first declaration of class template specialization of 'B' outside namespace 'N' is a C++11 extension}}
-#endif
namespace M {
@@ -121,9 +115,9 @@ class Wibble<int> { }; // expected-error{{cannot specialize a template template
namespace rdar9676205 {
template<typename T>
- struct X {
+ struct X { // expected-note {{here}}
template<typename U>
- struct X<U*> { // expected-error{{explicit specialization of 'X' in class scope}}
+ struct X<U*> { // expected-error{{partial specialization of 'X' not in a namespace enclosing}}
};
};
diff --git a/clang/test/SemaTemplate/ext_ms_template_spec.cpp b/clang/test/SemaTemplate/ext_ms_template_spec.cpp
index fc2ed16f9f8..cb303217ea9 100644
--- a/clang/test/SemaTemplate/ext_ms_template_spec.cpp
+++ b/clang/test/SemaTemplate/ext_ms_template_spec.cpp
@@ -18,16 +18,16 @@ template <typename T> struct X {
namespace B {
template <>
-class A::ClassTemplate<int>; // expected-warning {{class template specialization of 'ClassTemplate' outside namespace enclosing 'A' is a Microsoft extension}}
+class A::ClassTemplate<int>; // expected-warning {{class template specialization of 'ClassTemplate' not in a namespace enclosing 'A' is a Microsoft extension}}
template <class T1>
-class A::ClassTemplatePartial<T1, T1 *> {}; // expected-warning {{class template partial specialization of 'ClassTemplatePartial' outside namespace enclosing 'A' is a Microsoft extension}}
+class A::ClassTemplatePartial<T1, T1 *> {}; // expected-warning {{class template partial specialization of 'ClassTemplatePartial' not in a namespace enclosing 'A' is a Microsoft extension}}
template <>
-struct A::X<int>::MemberClass; // expected-warning {{member class specialization of 'MemberClass' outside namespace enclosing 'A' is a Microsoft extension}}
+struct A::X<int>::MemberClass; // expected-warning {{member class specialization of 'MemberClass' not in class 'X' or an enclosing namespace is a Microsoft extension}}
template <>
-enum A::X<int>::MemberEnumeration; // expected-warning {{member enumeration specialization of 'MemberEnumeration' outside namespace enclosing 'A' is a Microsoft extension}} // expected-error {{ISO C++ forbids forward references to 'enum' types}}
+enum A::X<int>::MemberEnumeration; // expected-warning {{member enumeration specialization of 'MemberEnumeration' not in class 'X' or an enclosing namespace is a Microsoft extension}} // expected-error {{ISO C++ forbids forward references to 'enum' types}}
}
diff --git a/clang/test/SemaTemplate/function-template-specialization.cpp b/clang/test/SemaTemplate/function-template-specialization.cpp
index 6327ff64c33..a3669fd7fdd 100644
--- a/clang/test/SemaTemplate/function-template-specialization.cpp
+++ b/clang/test/SemaTemplate/function-template-specialization.cpp
@@ -54,5 +54,5 @@ class Foo {
// Don't crash here.
template<>
- static void Bar(const long& input) {} // expected-error{{explicit specialization of 'Bar' in class scope}}
+ static void Bar(const long& input) {} // expected-warning{{explicit specialization cannot have a storage class}}
};
diff --git a/clang/test/SemaTemplate/instantiate-method.cpp b/clang/test/SemaTemplate/instantiate-method.cpp
index 961884417b5..9cd668dacf5 100644
--- a/clang/test/SemaTemplate/instantiate-method.cpp
+++ b/clang/test/SemaTemplate/instantiate-method.cpp
@@ -185,7 +185,7 @@ namespace SameSignatureAfterInstantiation {
namespace PR22040 {
template <typename T> struct Foobar {
- template <> void bazqux(typename T::type) {} // expected-error {{cannot specialize a function 'bazqux' within class scope}} expected-error 2{{cannot be used prior to '::' because it has no members}}
+ template <> void bazqux(typename T::type) {} // expected-error 2{{cannot be used prior to '::' because it has no members}}
};
void test() {
diff --git a/clang/test/SemaTemplate/ms-function-specialization-class-scope.cpp b/clang/test/SemaTemplate/ms-function-specialization-class-scope.cpp
index 3c7111d0583..dcab9bfaeab 100644
--- a/clang/test/SemaTemplate/ms-function-specialization-class-scope.cpp
+++ b/clang/test/SemaTemplate/ms-function-specialization-class-scope.cpp
@@ -1,18 +1,15 @@
// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s
// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s
+// expected-no-diagnostics
class A {
public:
template<class U> A(U p) {}
- template<> A(int p) {
- // expected-warning@-1 {{explicit specialization of 'A' within class scope is a Microsoft extension}}
- }
+ template<> A(int p) {}
template<class U> void f(U p) {}
- template<> void f(int p) {
- // expected-warning@-1 {{explicit specialization of 'f' within class scope is a Microsoft extension}}
- }
+ template<> void f(int p) {}
void f(int p) {}
};
@@ -28,14 +25,11 @@ void test1() {
template<class T> class B {
public:
template<class U> B(U p) {}
- template<> B(int p) {
- // expected-warning@-1 {{explicit specialization of 'B<T>' within class scope is a Microsoft extension}}
- }
+ template<> B(int p) {}
template<class U> void f(U p) { T y = 9; }
template<> void f(int p) {
- // expected-warning@-1 {{explicit specialization of 'f' within class scope is a Microsoft extension}}
T a = 3;
}
@@ -56,9 +50,7 @@ namespace PR12709 {
template<bool b> void specialized_member_template() {}
- template<> void specialized_member_template<false>() {
- // expected-warning@-1 {{explicit specialization of 'specialized_member_template' within class scope is a Microsoft extension}}
- }
+ template<> void specialized_member_template<false>() {}
};
void f() { TemplateClass<int> t; }
@@ -67,8 +59,8 @@ namespace PR12709 {
namespace Duplicates {
template<typename T> struct A {
template<typename U> void f();
- template<> void f<int>() {} // expected-warning {{Microsoft extension}}
- template<> void f<T>() {} // expected-warning {{Microsoft extension}}
+ template<> void f<int>() {}
+ template<> void f<T>() {}
};
// FIXME: We should diagnose the duplicate explicit specialization definitions
@@ -81,6 +73,6 @@ struct S {
template <int>
int f(int = 0);
template <>
- int f<0>(int); // expected-warning {{Microsoft extension}}
+ int f<0>(int);
};
}
diff --git a/clang/test/SemaTemplate/temp_class_spec_neg.cpp b/clang/test/SemaTemplate/temp_class_spec_neg.cpp
index 6366a528ff5..7465e5e8caa 100644
--- a/clang/test/SemaTemplate/temp_class_spec_neg.cpp
+++ b/clang/test/SemaTemplate/temp_class_spec_neg.cpp
@@ -7,17 +7,11 @@ template<typename T> struct vector;
namespace N {
namespace M {
template<typename T> struct A;
-#if __cplusplus <= 199711L // C++03 or earlier modes
- // expected-note@-2{{explicitly specialized declaration is here}}
-#endif
}
}
template<typename T>
struct N::M::A<T*> { };
-#if __cplusplus <= 199711L
-// expected-warning@-2{{first declaration of class template partial specialization of 'A' outside namespace 'M' is a C++11 extension}}
-#endif
// C++ [temp.class.spec]p9
// bullet 1, as amended by DR1315
OpenPOWER on IntegriCloud