================ @@ -738,16 +738,47 @@ Parser::DeclGroupPtrTy Parser::ParseUsingDeclaration( return nullptr; } - if (!Tok.is(tok::identifier)) { + Decl *UED = nullptr; + + if (Tok.is(tok::identifier)) { + IdentifierInfo *IdentInfo = Tok.getIdentifierInfo(); + SourceLocation IdentLoc = ConsumeToken(); + + ParsedType Type = Actions.getTypeName( + *IdentInfo, IdentLoc, getCurScope(), &SS, /*isClassName=*/true, + /*HasTrailingDot=*/false, + /*ObjectType=*/nullptr, /*IsCtorOrDtorName=*/false, + /*WantNontrivialTypeSourceInfo=*/true); + + UED = Actions.ActOnUsingEnumDeclaration( + getCurScope(), AS, UsingLoc, UELoc, IdentLoc, *IdentInfo, Type, &SS); + } else if (Tok.is(tok::annot_template_id)) { + TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok); + + if (TemplateId->mightBeType()) { + AnnotateTemplateIdTokenAsType(SS, ImplicitTypenameContext::No, + /*IsClassName=*/true); + + assert(Tok.is(tok::annot_typename) && "template-id -> type failed"); + TypeResult Type = getTypeAnnotation(Tok); + SourceRange Loc = Tok.getAnnotationRange(); + ConsumeAnnotationToken(); + + UED = Actions.ActOnUsingEnumDeclaration(getCurScope(), AS, UsingLoc, + UELoc, Loc, *TemplateId->Name, + Type.get(), &SS); + } else { + Diag(Tok.getLocation(), diag::err_using_enum_not_enum) + << TemplateId->Name->getName() ---------------- cor3ntin wrote:
We don't do it for base specifier, so i think this is fine (I suspect improvements would be a bit difficult, maybe by calling `ClassifyName`) https://github.com/llvm/llvm-project/pull/95399 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits