diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-09 22:14:25 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-09 22:14:25 +0000 |
commit | 7bf80c8d8f328456a72c31e07837096023b6659b (patch) | |
tree | 4d6f68ad6a66ee5321e16f640a5cdd1fd7571dfc /test/SemaTemplate | |
parent | 05157f019a673fad31e11d9ceaaea1b78ef3de90 (diff) |
Diagnose attempts to explicitly instantiate a template at class scope. Previously Clang would simply ignore the 'template' keyword in this case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r-- | test/SemaTemplate/explicit-instantiation.cpp | 4 | ||||
-rw-r--r-- | test/SemaTemplate/template-id-expr.cpp | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/test/SemaTemplate/explicit-instantiation.cpp b/test/SemaTemplate/explicit-instantiation.cpp index 040a932e97..010716dd14 100644 --- a/test/SemaTemplate/explicit-instantiation.cpp +++ b/test/SemaTemplate/explicit-instantiation.cpp @@ -103,8 +103,8 @@ namespace PR7622 { // Test that we do not crash. class TC1 { class TC2 { - template // FIXME: error here. - void foo() { } + template + void foo() { } // expected-error{{expected '<' after 'template'}} }; }; diff --git a/test/SemaTemplate/template-id-expr.cpp b/test/SemaTemplate/template-id-expr.cpp index e311b5832d..65c4e998ac 100644 --- a/test/SemaTemplate/template-id-expr.cpp +++ b/test/SemaTemplate/template-id-expr.cpp @@ -98,7 +98,11 @@ void f5() { template void f5<0>(); // expected-note {{in instantiation of function template specialization 'f5<0>' requested here}} class C {}; -template <template <typename> class D> // expected-note{{previous use is here}} +template <template <typename> class D> class E { - template class D<C>; // expected-error {{template template argument 'D' cannot be referenced with a class specifier}} + template class D<C>; // expected-error {{expected '<' after 'template'}} + template<> class D<C>; // expected-error {{cannot specialize a template template parameter}} + friend class D<C>; // expected-error {{type alias template 'D' cannot be referenced with a class specifier}} }; +template<typename T> using D = int; // expected-note {{declared here}} expected-warning {{extension}} +E<D> ed; // expected-note {{instantiation of}} |