Don't try to parse class template specializations in C. It can only

lead to heartache. Fixes <rdar://problem/8044088>.

llvm-svn: 105178
This commit is contained in:
Douglas Gregor 2010-05-30 22:30:21 +00:00
parent 3dbd7b51ca
commit d5a479cbb5
2 changed files with 4 additions and 3 deletions

View File

@ -670,7 +670,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
Name = Tok.getIdentifierInfo();
NameLoc = ConsumeToken();
if (Tok.is(tok::less)) {
if (Tok.is(tok::less) && getLang().CPlusPlus) {
// The name was supposed to refer to a template, but didn't.
// Eat the template argument list and try to continue parsing this as
// a class (or template thereof).
@ -713,8 +713,6 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
const_cast<ParsedTemplateInfo&>(TemplateInfo).ExternLoc
= SourceLocation();
}
}
} else if (Tok.is(tok::annot_template_id)) {
TemplateId = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());

View File

@ -83,3 +83,6 @@ void test12() {
// rdar://7608537
struct test13 { int a; } (test13x);
// <rdar://problem/8044088>
struct X<foo::int> { }; // expected-error{{expected identifier or '('}}