diff options
Diffstat (limited to 'test/CXX/temp/temp.spec')
-rw-r--r-- | test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp | 6 | ||||
-rw-r--r-- | test/CXX/temp/temp.spec/no-body.cpp | 4 | ||||
-rw-r--r-- | test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp | 44 | ||||
-rw-r--r-- | test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp | 2 | ||||
-rw-r--r-- | test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp | 4 |
5 files changed, 50 insertions, 10 deletions
diff --git a/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp b/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp index 93f8ff1697bf..7eb5e3744d18 100644 --- a/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp +++ b/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp @@ -24,14 +24,14 @@ template int pi0 = 10; // expected-error {{variable cannot be defined in an expl #endif template<typename T> -T pi1 = T(3.1415926535897932385); +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 {{no variable template matches specialization}} + 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 {{no variable template matches specialization}} + expected-error {{variable template specialization of 'pi1' must originally be declared in the global scope}} } #endif diff --git a/test/CXX/temp/temp.spec/no-body.cpp b/test/CXX/temp/temp.spec/no-body.cpp index a4d7914d9eb6..61d285b27ed2 100644 --- a/test/CXX/temp/temp.spec/no-body.cpp +++ b/test/CXX/temp/temp.spec/no-body.cpp @@ -37,7 +37,7 @@ namespace noargs_body { namespace exp_spec { #ifndef FIXING template<> void f0<int>(int) { } // expected-error {{no function template matches function template specialization 'f0'}} - template<> struct x0<int> { }; // expected-error {{class template specialization of 'x0' must originally be declared in the global scope}} + template<> struct x0<int> { }; // expected-error {{class template specialization of 'x0' must occur at global scope}} #endif } @@ -51,7 +51,7 @@ namespace args_bad { template void f1<int>(int) { } // 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 {{no function template matches function template specialization 'f1'}} template struct x1<int> { }; // 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 {{class template specialization of 'x1' must originally be declared in the global scope}} + expected-error {{class template specialization of 'x1' must occur at global scope}} #endif } diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp index 75b198e47d13..d0e24f547723 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-c++1y-extensions // This test creates cases where implicit instantiations of various entities // would cause a diagnostic, but provides expliict specializations for those @@ -10,6 +10,8 @@ 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: @@ -79,7 +81,7 @@ template<> struct N0::X0<void> { }; N0::X0<void> test_X0; namespace N1 { - template<> struct N0::X0<const void> { }; // expected-error{{class template specialization of 'X0' must originally be declared in namespace 'N0'}} + template<> struct N0::X0<const void> { }; // expected-error{{class template specialization of 'X0' not in a namespace enclosing 'N0'}} } namespace N0 { @@ -90,6 +92,44 @@ template<> struct N0::X0<volatile void> { void f1(void *); }; +// -- variable template [C++1y] +namespace N0 { +template<typename T> int v0; // expected-note +{{here}} +template<> extern int v0<char[1]>; +template<> extern int v0<char[2]>; +template<> extern int v0<char[5]>; +template<> extern int v0<char[6]>; +} +using N0::v0; + +template<typename T> int v1; // expected-note +{{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 ::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 ::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 +} + // -- member function of a class template template<> void N0::X0<void*>::f1(void *) { } diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp index c972bf7c7d0a..4fbc45a7d7dd 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp @@ -80,7 +80,7 @@ template<> struct N0::X0<void> { }; // expected-warning{{C++11 extension}} N0::X0<void> test_X0; namespace N1 { - template<> struct N0::X0<const void> { }; // expected-error{{originally}} + template<> struct N0::X0<const void> { }; // expected-error{{not in a namespace enclosing 'N0'}} } namespace N0 { diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp index d0df305941d9..24f68a094e54 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp @@ -20,8 +20,8 @@ template int X<int>::member2; // For implicit instantiation of long& get(bool Cond1, bool Cond2) { - // CHECK: @_ZN1XIlE7member1E = weak_odr global i64 0 - // CHECK: @_ZN1XIlE7member2E = weak_odr global i64 17 + // CHECK: @_ZN1XIlE7member1E = linkonce_odr global i64 0 + // CHECK: @_ZN1XIlE7member2E = linkonce_odr global i64 17 // CHECK: @_ZN1XIlE7member3E = external global i64 return Cond1? X<long>::member1 : Cond2? X<long>::member2 |