From 46c59614d345a91ff586daea0cb4537f8bc1866a Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 12 Jan 2010 17:52:59 +0000 Subject: Parse dependent template-ids in base clauses and member initializers. This isn't actually in the C++ grammar (in any version), but that's clearly an oversight: both GCC and EDG support this syntax, and it's used within Boost code. I'll file a core issue proposing precisely the change made here. Fixes PR6008. llvm-svn: 93243 --- clang/lib/Parse/ParseDeclCXX.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/Parse/ParseDeclCXX.cpp') diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 265d0f3e849..61a494193c7 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -468,7 +468,8 @@ Parser::TypeResult Parser::ParseClassName(SourceLocation &EndLocation, if (Tok.is(tok::annot_template_id)) { TemplateIdAnnotation *TemplateId = static_cast(Tok.getAnnotationValue()); - if (TemplateId->Kind == TNK_Type_template) { + if (TemplateId->Kind == TNK_Type_template || + TemplateId->Kind == TNK_Dependent_template_name) { AnnotateTemplateIdTokenAsType(SS); assert(Tok.is(tok::annot_typename) && "template-id -> type failed"); @@ -1527,12 +1528,12 @@ Parser::MemInitResult Parser::ParseMemInitializer(DeclPtrTy ConstructorDecl) { if (Tok.is(tok::annot_template_id)) { TemplateIdAnnotation *TemplateId = static_cast(Tok.getAnnotationValue()); - if (TemplateId->Kind == TNK_Type_template) { + if (TemplateId->Kind == TNK_Type_template || + TemplateId->Kind == TNK_Dependent_template_name) { AnnotateTemplateIdTokenAsType(&SS); assert(Tok.is(tok::annot_typename) && "template-id -> type failed"); TemplateTypeTy = Tok.getAnnotationValue(); } - // FIXME. May need to check for TNK_Dependent_template as well. } if (!TemplateTypeTy && Tok.isNot(tok::identifier)) { Diag(Tok, diag::err_expected_member_or_base_name); -- cgit v1.2.3