From 52c5b87cc9aa76de642dcc76d563b6c9eb0f24f1 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 29 Jan 2013 04:13:32 +0000 Subject: [PATCH] PR15017: A '>' can appear after a type-specifier in a template-argument-list. It turns out that there's no correctness bug here (because we can't have a type definition in this location), but there was a diagnostic bug. llvm-svn: 173766 --- clang/lib/Parse/ParseDeclCXX.cpp | 3 +++ clang/test/Parser/cxx-decl.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 2c5d142..4f0c893 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -1015,6 +1015,9 @@ bool Parser::isValidAfterTypeSpecifier(bool CouldBeBitfield) { case tok::l_square: // enum E [[]] x // Note, no tok::kw_alignas here; alignas cannot appertain to a type. return getLangOpts().CPlusPlus11 && NextToken().is(tok::l_square); + case tok::greater: + // template + return getLangOpts().CPlusPlus; } return false; } diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp index 71fd7aa..24ba127 100644 --- a/clang/test/Parser/cxx-decl.cpp +++ b/clang/test/Parser/cxx-decl.cpp @@ -180,6 +180,10 @@ void test (DIE die, DIE *Die, DIE INT, DIE *FLOAT) { FLOAT->foo(); } +namespace PR15017 { + template struct S {}; // expected-error {{'PR15017::X' can not be defined in a type specifier}} +} + // PR8380 extern "" // expected-error {{unknown linkage language}} test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \ -- 2.7.4