summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDeclCXX.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-07-14 21:35:26 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-07-14 21:35:26 +0000
commit7b8c3c91f4c3781f09113c82fcca835d71eaae15 (patch)
tree1d49fa833b90ad340d2c5fc8dacd58716ac5111f /clang/lib/Parse/ParseDeclCXX.cpp
parent4036b587df876032248bbe03fcae21d63a6697fe (diff)
downloadbcm5719-llvm-7b8c3c91f4c3781f09113c82fcca835d71eaae15.tar.gz
bcm5719-llvm-7b8c3c91f4c3781f09113c82fcca835d71eaae15.zip
PR10359: Template declarations which define classes are not permitted to also contain declarators. Previously we would accept code like this:
template<typename T> struct S { } f() { return 0; } This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template. Treat this llvm-svn: 135195
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index d78f3728e1b..172049c3405 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -1291,6 +1291,11 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
break;
}
+ // C++ [temp]p3 In a template-declaration which defines a class, no
+ // declarator is permitted.
+ if (TemplateInfo.Kind)
+ ExpectedSemi = true;
+
if (ExpectedSemi) {
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,
TagType == DeclSpec::TST_class ? "class"
OpenPOWER on IntegriCloud