erik.pilkington updated this revision to Diff 52641. erik.pilkington added a comment.
Include local static data member template in test. Thanks for taking a look Richard, would you mind committing this for me? http://reviews.llvm.org/D18653 Files: lib/Sema/SemaDeclCXX.cpp test/CXX/temp/temp.decls/temp.mem/p2.cpp Index: test/CXX/temp/temp.decls/temp.mem/p2.cpp =================================================================== --- test/CXX/temp/temp.decls/temp.mem/p2.cpp +++ test/CXX/temp/temp.decls/temp.mem/p2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s template <typename> void quux(); @@ -8,5 +8,7 @@ template <typename> struct bar {}; // expected-error{{templates cannot be declared inside of a local class}} template <typename> void baz() {} // expected-error{{templates cannot be declared inside of a local class}} template <typename> void qux(); // expected-error{{templates cannot be declared inside of a local class}} + template <typename> using corge = int; // expected-error{{templates cannot be declared inside of a local class}} + template <typename T> static T grault; // expected-error{{static data member}} expected-error{{templates cannot be declared inside of a local class}} }; } Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -8585,6 +8585,10 @@ } TemplateParameterList *TemplateParams = TemplateParamLists[0]; + // Check that we can declare a template here. + if (CheckTemplateDeclScope(S, TemplateParams)) + return nullptr; + // Only consider previous declarations in the same scope. FilterLookupForScope(Previous, CurContext, S, /*ConsiderLinkage*/false, /*ExplicitInstantiationOrSpecialization*/false);
Index: test/CXX/temp/temp.decls/temp.mem/p2.cpp =================================================================== --- test/CXX/temp/temp.decls/temp.mem/p2.cpp +++ test/CXX/temp/temp.decls/temp.mem/p2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s template <typename> void quux(); @@ -8,5 +8,7 @@ template <typename> struct bar {}; // expected-error{{templates cannot be declared inside of a local class}} template <typename> void baz() {} // expected-error{{templates cannot be declared inside of a local class}} template <typename> void qux(); // expected-error{{templates cannot be declared inside of a local class}} + template <typename> using corge = int; // expected-error{{templates cannot be declared inside of a local class}} + template <typename T> static T grault; // expected-error{{static data member}} expected-error{{templates cannot be declared inside of a local class}} }; } Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -8585,6 +8585,10 @@ } TemplateParameterList *TemplateParams = TemplateParamLists[0]; + // Check that we can declare a template here. + if (CheckTemplateDeclScope(S, TemplateParams)) + return nullptr; + // Only consider previous declarations in the same scope. FilterLookupForScope(Previous, CurContext, S, /*ConsiderLinkage*/false, /*ExplicitInstantiationOrSpecialization*/false);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits