diff options
Diffstat (limited to 'clang/test')
19 files changed, 98 insertions, 133 deletions
diff --git a/clang/test/CXX/drs/dr0xx.cpp b/clang/test/CXX/drs/dr0xx.cpp index fbca6635ec1..a311d8f3393 100644 --- a/clang/test/CXX/drs/dr0xx.cpp +++ b/clang/test/CXX/drs/dr0xx.cpp @@ -499,10 +499,10 @@ namespace dr42 { // dr42: yes // dr43: na -namespace dr44 { // dr44: yes +namespace dr44 { // dr44: sup 727 struct A { template<int> void f(); - template<> void f<0>(); // expected-error {{explicit specialization of 'f' in class scope}} + template<> void f<0>(); }; } diff --git a/clang/test/CXX/drs/dr3xx.cpp b/clang/test/CXX/drs/dr3xx.cpp index 3342148461a..0de2d495a34 100644 --- a/clang/test/CXX/drs/dr3xx.cpp +++ b/clang/test/CXX/drs/dr3xx.cpp @@ -925,7 +925,7 @@ namespace dr373 { // dr373: 5 using namespace A::B; // expected-error {{expected namespace name}} } -namespace dr374 { // dr374: yes c++11 +namespace dr374 { // dr374: yes namespace N { template<typename T> void f(); template<typename T> struct A { void f(); }; @@ -933,11 +933,6 @@ namespace dr374 { // dr374: yes c++11 template<> void N::f<char>() {} template<> void N::A<char>::f() {} template<> struct N::A<int> {}; -#if __cplusplus < 201103L - // expected-error@-4 {{extension}} expected-note@-7 {{here}} - // expected-error@-4 {{extension}} expected-note@-7 {{here}} - // expected-error@-4 {{extension}} expected-note@-8 {{here}} -#endif } // dr375: dup 345 diff --git a/clang/test/CXX/drs/dr7xx.cpp b/clang/test/CXX/drs/dr7xx.cpp index fe4a2dc5ee4..982ffdddab3 100644 --- a/clang/test/CXX/drs/dr7xx.cpp +++ b/clang/test/CXX/drs/dr7xx.cpp @@ -3,6 +3,53 @@ // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +namespace dr727 { // dr727: 7 + struct A { + template<typename T> struct C; // expected-note 6{{here}} + template<typename T> void f(); // expected-note {{here}} + template<typename T> static int N; // expected-error 0-1{{C++14}} expected-note 6{{here}} + + template<> struct C<int>; + template<> void f<int>(); + template<> static int N<int>; + + template<typename T> struct C<T*>; + template<typename T> static int N<T*>; + + struct B { + template<> struct C<float>; // expected-error {{not in class 'A' or an enclosing namespace}} + template<> void f<float>(); // expected-error {{no function template matches}} + template<> static int N<float>; // expected-error {{not in class 'A' or an enclosing namespace}} + + template<typename T> struct C<T**>; // expected-error {{not in class 'A' or an enclosing namespace}} + template<typename T> static int N<T**>; // expected-error {{not in class 'A' or an enclosing namespace}} + + template<> struct A::C<double>; // expected-error {{not in class 'A' or an enclosing namespace}} + template<> void A::f<double>(); // expected-error {{no function template matches}} expected-error {{cannot have a qualified name}} + template<> static int A::N<double>; // expected-error {{not in class 'A' or an enclosing namespace}} expected-error {{cannot have a qualified name}} + + template<typename T> struct A::C<T***>; // expected-error {{not in class 'A' or an enclosing namespace}} + template<typename T> static int A::N<T***>; // expected-error {{not in class 'A' or an enclosing namespace}} expected-error {{cannot have a qualified name}} + }; + }; + + template<> struct A::C<char>; + template<> void A::f<char>(); + template<> int A::N<char>; + + template<typename T> struct A::C<T****>; + template<typename T> int A::N<T****>; + + namespace C { + template<> struct A::C<long>; // expected-error {{not in class 'A' or an enclosing namespace}} + template<> void A::f<long>(); // expected-error {{not in class 'A' or an enclosing namespace}} + template<> int A::N<long>; // expected-error {{not in class 'A' or an enclosing namespace}} + + template<typename T> struct A::C<T*****>; // expected-error {{not in class 'A' or an enclosing namespace}} + template<typename T> int A::N<T*****>; // expected-error {{not in class 'A' or an enclosing namespace}} + } +} + namespace dr777 { // dr777: 3.7 #if __cplusplus >= 201103L template <typename... T> @@ -16,5 +63,3 @@ template <typename... T> void h(int i = 0, T ...args, int j = 1) {} #endif } - -// expected-no-diagnostics diff --git a/clang/test/CXX/temp/temp.deduct.guide/p1.cpp b/clang/test/CXX/temp/temp.deduct.guide/p1.cpp index c0a2ba1129e..8bb9da8a972 100644 --- a/clang/test/CXX/temp/temp.deduct.guide/p1.cpp +++ b/clang/test/CXX/temp/temp.deduct.guide/p1.cpp @@ -101,7 +101,7 @@ namespace ExplicitInst { struct X { template<typename T> struct C {}; template<typename T> C(T) -> C<T>; - template<> C(int) -> C<int>; // expected-error {{explicit specialization of '<deduction guide for C>' in class scope}} + template<> C(int) -> C<int>; // expected-error {{deduction guide cannot be explicitly specialized}} extern template C(float) -> C<float>; // expected-error {{expected member name or ';'}} template C(char) -> C<char>; // expected-error {{expected '<' after 'template'}} }; diff --git a/clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp b/clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp index 425d527e521..741ebc5de41 100644 --- a/clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp +++ b/clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp @@ -28,10 +28,8 @@ T pi1 = T(3.1415926535897932385); // expected-note 0-2 {{here}} // Should recover as if specialization template float pi1<float> = 1.0; // expected-error {{explicit template instantiation cannot have a definition; if this definition is meant to be an explicit specialization, add '<>' after the 'template' keyword}} -#ifndef FIXING namespace expected_global { - template<> double pi1<double> = 1.5; // expected-error {{variable template specialization of 'pi1' must originally be declared in the global scope}} - template int pi1<int> = 10; // expected-error {{explicit template instantiation cannot have a definition; if this definition is meant to be an explicit specialization, add '<>' after the 'template' keyword}} \ - expected-error {{variable template specialization of 'pi1' must originally be declared in the global scope}} -} +#ifndef FIXING + template int pi1<int> = 10; // expected-error {{explicit template instantiation cannot have a definition; if this definition is meant to be an explicit specialization, add '<>' after the 'template' keyword}} expected-error {{must occur at global scope}} #endif +} diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp index d0e24f54772..c29646dd945 100644 --- a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp +++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp @@ -10,9 +10,6 @@ struct NonDefaultConstructible { NonDefaultConstructible(int); }; -// FIXME: The "must originally be declared in namespace" diagnostics throughout -// this file are wrong. - // C++ [temp.expl.spec]p1: // An explicit specialization of any of the following: @@ -43,7 +40,7 @@ template<> void N0::f0(double) { } struct X1 { template<typename T> void f(T); - template<> void f(int); // expected-error{{in class scope}} + template<> void f(int); // OK (DR727) }; // -- class template @@ -94,7 +91,7 @@ template<> struct N0::X0<volatile void> { // -- variable template [C++1y] namespace N0 { -template<typename T> int v0; // expected-note +{{here}} +template<typename T> int v0; // expected-note 4{{explicitly specialized declaration is here}} template<> extern int v0<char[1]>; template<> extern int v0<char[2]>; template<> extern int v0<char[5]>; @@ -102,32 +99,32 @@ template<> extern int v0<char[6]>; } using N0::v0; -template<typename T> int v1; // expected-note +{{here}} +template<typename T> int v1; // expected-note 4{{explicitly specialized declaration is here}} template<> extern int v1<char[3]>; template<> extern int v1<char[4]>; template<> extern int v1<char[7]>; template<> extern int v1<char[8]>; template<> int N0::v0<int[1]>; -template<> int v0<int[2]>; // FIXME: ill-formed +template<> int v0<int[2]>; template<> int ::v1<int[3]>; // expected-warning {{extra qualification}} template<> int v1<int[4]>; template<> int N0::v0<char[1]>; -template<> int v0<char[2]>; // FIXME: ill-formed +template<> int v0<char[2]>; template<> int ::v1<char[3]>; // expected-warning {{extra qualification}} template<> int v1<char[4]>; namespace N1 { -template<> int N0::v0<int[5]>; // expected-error {{must originally be declared in namespace 'N0'}} expected-error {{does not enclose namespace}} -template<> int v0<int[6]>; // expected-error {{must originally be declared in namespace 'N0'}} -template<> int ::v1<int[7]>; // expected-error {{must originally be declared in the global scope}} expected-error {{cannot name the global scope}} -template<> int v1<int[8]>; // expected-error {{must originally be declared in the global scope}} - -template<> int N0::v0<char[5]>; // expected-error {{does not enclose namespace 'N0'}} -template<> int v0<char[6]>; // FIXME: ill-formed -template<> int ::v1<char[7]>; // expected-error {{cannot name the global scope}} -template<> int v1<char[8]>; // FIXME: ill-formed +template<> int N0::v0<int[5]>; // expected-error {{not in a namespace enclosing 'N0'}} +template<> int v0<int[6]>; // expected-error {{not in a namespace enclosing 'N0'}} +template<> int ::v1<int[7]>; // expected-error {{must occur at global scope}} +template<> int v1<int[8]>; // expected-error {{must occur at global scope}} + +template<> int N0::v0<char[5]>; // expected-error {{not in a namespace enclosing 'N0'}} +template<> int v0<char[6]>; // expected-error {{not in a namespace enclosing 'N0'}} +template<> int ::v1<char[7]>; // expected-error {{must occur at global scope}} +template<> int v1<char[8]>; // expected-error {{must occur at global scope}} } // -- member function of a class template diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp index 21399b62046..904f950df44 100644 --- a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp +++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp @@ -20,9 +20,6 @@ struct NonDefaultConstructible { // -- function template namespace N0 { template<typename T> void f0(T) { -#if __cplusplus <= 199711L - // expected-note@-2 {{explicitly specialized declaration is here}} -#endif T t; } @@ -43,16 +40,13 @@ namespace N1 { } template<> void N0::f0(double); -#if __cplusplus <= 199711L -// expected-warning@-2 {{first declaration of function template specialization of 'f0' outside namespace 'N0' is a C++11 extension}} -#endif template<> void N0::f0(double) { } struct X1 { template<typename T> void f(T); - template<> void f(int); // expected-error{{in class scope}} + template<> void f(int); }; // -- class template @@ -60,38 +54,20 @@ namespace N0 { template<typename T> struct X0 { // expected-note {{explicitly specialized declaration is here}} -#if __cplusplus <= 199711L -// expected-note@-2 {{explicitly specialized declaration is here}} -#endif static T member; -#if __cplusplus <= 199711L - // expected-note@-2 {{explicitly specialized declaration is here}} -#endif void f1(T t) { -#if __cplusplus <= 199711L - // expected-note@-2 {{explicitly specialized declaration is here}} -#endif t = 17; } struct Inner : public T { }; // expected-note 2{{explicitly specialized declaration is here}} -#if __cplusplus <= 199711L - // expected-note@-2 {{explicitly specialized declaration is here}} -#endif template<typename U> struct InnerTemplate : public T { }; // expected-note {{explicitly specialized declaration is here}} -#if __cplusplus <= 199711L - // expected-note@-2 {{explicitly specialized declaration is here}} -#endif - // expected-error@-4 {{base specifier must name a class}} + // expected-error@-1 {{base specifier must name a class}} template<typename U> void ft1(T t, U u); -#if __cplusplus <= 199711L - // expected-note@-2 {{explicitly specialized declaration is here}} -#endif }; } @@ -105,9 +81,6 @@ void N0::X0<T>::ft1(T t, U u) { template<typename T> T N0::X0<T>::member; template<> struct N0::X0<void> { }; -#if __cplusplus <= 199711L -// expected-warning@-2 {{first declaration of class template specialization of 'X0' outside namespace 'N0' is a C++11 extension}} -#endif N0::X0<void> test_X0; namespace N1 { @@ -124,9 +97,6 @@ template<> struct N0::X0<volatile void> { // -- member function of a class template template<> void N0::X0<void*>::f1(void *) { } -#if __cplusplus <= 199711L -// expected-warning@-2 {{first declaration of member function specialization of 'f1' outside namespace 'N0' is a C++11 extension}} -#endif void test_spec(N0::X0<void*> xvp, void *vp) { xvp.f1(vp); @@ -160,9 +130,6 @@ NonDefaultConstructible &get_static_member() { } template<> int N0::X0<int>::member; -#if __cplusplus <= 199711L -// expected-warning@-2 {{first declaration of static data member specialization of 'member' outside namespace 'N0' is a C++11 extension}} -#endif template<> float N0::X0<float>::member = 3.14f; @@ -191,9 +158,6 @@ namespace N0 { template<> struct N0::X0<long>::Inner { }; -#if __cplusplus <= 199711L -// expected-warning@-2 {{first declaration of member class specialization of 'Inner' outside namespace 'N0' is a C++11 extension}} -#endif template<> struct N0::X0<float>::Inner { }; @@ -233,9 +197,6 @@ struct N0::X0<int>::InnerTemplate<long> { }; // okay template<> template<> struct N0::X0<int>::InnerTemplate<float> { }; -#if __cplusplus <= 199711L -// expected-warning@-2 {{first declaration of class template specialization of 'InnerTemplate' outside namespace 'N0' is a C++11 extension}} -#endif namespace N1 { template<> template<> @@ -268,9 +229,6 @@ void N0::X0<void*>::ft1(void *, unsigned) { } // okay template<> template<> void N0::X0<void*>::ft1(void *, float) { } -#if __cplusplus <= 199711L -// expected-warning@-2 {{first declaration of function template specialization of 'ft1' outside namespace 'N0' is a C++11 extension}} -#endif namespace N1 { template<> template<> @@ -293,6 +251,6 @@ namespace PR8979 { template<typename T, typename U> void f(Inner<T, U>&); typedef Inner<OtherInner, OtherInner> MyInner; - template<> void f(MyInner&); // expected-error{{cannot specialize a function 'f' within class scope}} + template<> void f(MyInner&); }; } diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp index d82691c7c86..ca55c54a5e9 100644 --- a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp +++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp @@ -4,17 +4,9 @@ namespace N { template<class T> class X; // expected-note {{'N::X' declared here}} -#if __cplusplus <= 199711L - // expected-note@-2 {{explicitly specialized declaration is here}} -#endif } -// TODO: Don't add a namespace qualifier to the template if it would trigger -// the warning about the specialization being outside of the namespace. template<> class X<int> { /* ... */ }; // expected-error {{no template named 'X'; did you mean 'N::X'?}} -#if __cplusplus <= 199711L -// expected-warning@-2 {{first declaration of class template specialization of 'X' outside namespace 'N' is a C++11 extension}} -#endif namespace N { diff --git a/clang/test/Misc/ast-dump-decl.cpp b/clang/test/Misc/ast-dump-decl.cpp index c689149af06..21ba7ec8dad 100644 --- a/clang/test/Misc/ast-dump-decl.cpp +++ b/clang/test/Misc/ast-dump-decl.cpp @@ -360,7 +360,9 @@ class TestClassScopeFunctionSpecialization { template<> void foo<int>(int a) { }
};
// CHECK: ClassScopeFunctionSpecializationDecl
-// CHECK-NEXT: CXXMethod{{.*}} 'foo' 'void (int)'
+// CHECK-NEXT: CXXMethod{{.*}} foo 'void (int)'
+// CHECK-NEXT: ParmVarDecl
+// CHECK-NEXT: CompoundStmt
// CHECK-NEXT: TemplateArgument{{.*}} 'int'
namespace TestTemplateTypeParmDecl {
diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp index c605dcb912f..55adb68d2e4 100644 --- a/clang/test/SemaCXX/MicrosoftExtensions.cpp +++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp @@ -489,7 +489,6 @@ void AfterClassBody() { namespace PR24246 { template <typename TX> struct A { template <bool> struct largest_type_select; - // expected-warning@+1 {{explicit specialization of 'largest_type_select' within class scope is a Microsoft extension}} template <> struct largest_type_select<false> { blah x; // expected-error {{unknown type name 'blah'}} }; diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp index 66f0f10f0f3..04c4429368f 100644 --- a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp +++ b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp @@ -15,8 +15,8 @@ class A { template<typename T> static CONST T right<T,int> = 5; template<typename T> CONST int right<int,T>; // expected-error {{member 'right' declared as a template}} template<typename T> CONST float right<float,T> = 5; // expected-error {{member 'right' declared as a template}} - template<> static CONST int right<int,int> = 7; // expected-error {{explicit specialization of 'right' in class scope}} - template<> static CONST float right<float,int>; // expected-error {{explicit specialization of 'right' in class scope}} + template<> static CONST int right<int,int> = 7; + template<> static CONST float right<float,int>; template static CONST int right<int,int>; // expected-error {{expected '<' after 'template'}} }; @@ -163,8 +163,8 @@ namespace constexpred { template<typename T> constexpr int right<int,T>; // expected-error {{member 'right' declared as a template}} \ // expected-error {{non-static data member cannot be constexpr; did you intend to make it const?}} template<typename T> constexpr float right<float,T> = 5; // expected-error {{non-static data member cannot be constexpr; did you intend to make it static?}} - template<> static constexpr int right<int,int> = 7; // expected-error {{explicit specialization of 'right' in class scope}} - template<> static constexpr float right<float,int>; // expected-error {{explicit specialization of 'right' in class scope}} + template<> static constexpr int right<int,int> = 7; + template<> static constexpr float right<float,int>; // expected-error {{requires an initializer}} template static constexpr int right<int,int>; // expected-error {{expected '<' after 'template'}} }; } diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp index a78548b6f12..ecd9593c675 100644 --- a/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp +++ b/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp @@ -409,7 +409,7 @@ namespace nested { #endif float f1 = pi1a<float>; - template<> double pi1a<double> = 5.2; // expected-error {{variable template specialization of 'pi1a' must originally be declared in namespace 'n1'}} + template<> double pi1a<double> = 5.2; // expected-error {{not in a namespace enclosing 'n1'}} double d1 = pi1a<double>; } @@ -422,8 +422,7 @@ namespace nested { #endif float f1 = n1::pi1b<float>; - template<> double n1::pi1b<double> = 5.2; // expected-error {{cannot define or redeclare 'pi1b' here because namespace 'use_n1b' does not enclose namespace 'n1'}} \ - // expected-error {{variable template specialization of 'pi1b' must originally be declared in namespace 'n1'}} + template<> double n1::pi1b<double> = 5.2; // expected-error {{not in a namespace enclosing 'n1'}} double d1 = n1::pi1b<double>; } } diff --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp index 4a9baf5100d..33516f70687 100644 --- a/clang/test/SemaCXX/cxx98-compat.cpp +++ b/clang/test/SemaCXX/cxx98-compat.cpp @@ -185,9 +185,9 @@ namespace RedundantParensInAddressTemplateParam { } namespace TemplateSpecOutOfScopeNs { - template<typename T> struct S {}; // expected-note {{here}} + template<typename T> struct S {}; } -template<> struct TemplateSpecOutOfScopeNs::S<char> {}; // expected-warning {{class template specialization of 'S' outside namespace 'TemplateSpecOutOfScopeNs' is incompatible with C++98}} +template<> struct TemplateSpecOutOfScopeNs::S<char> {}; struct Typename { template<typename T> struct Inner {}; 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 |