From: Douglas Gregor Date: Thu, 22 Oct 2009 18:02:20 +0000 (+0000) Subject: When replacing a template-id expression with a declaration reference expression after... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=423a4e0c853be8f312de9f91a4809eb3a753f824;p=clang When replacing a template-id expression with a declaration reference expression after overloading completes, make sure to keep the qualifier. Still not ready with that test-case... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84880 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index bcca6ece80..ebcf3ad8e2 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -5383,6 +5383,8 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn) { ClassType.getTypePtr())); return E; } + // FIXME: TemplateIdRefExpr referring to a member function template + // specialization! } Expr *NewExpr = FixOverloadedFunctionReference(UnOp->getSubExpr(), Fn); UnOp->setSubExpr(NewExpr); @@ -5399,10 +5401,17 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn) { MemExpr->setMemberDecl(Fn); E->setType(Fn->getType()); } else if (TemplateIdRefExpr *TID = dyn_cast(E)) { - // FIXME: Should we create QualifiedDeclRefExprs here too? // FIXME: We should capture the template arguments here. - E = new (Context) DeclRefExpr(Fn, Fn->getType(), - TID->getSourceRange().getBegin()); + if (NestedNameSpecifier *Qualifier = TID->getQualifier()) + E = new (Context) QualifiedDeclRefExpr(Fn, Fn->getType(), + TID->getTemplateNameLoc(), + /*FIXME?*/false, /*FIXME?*/false, + TID->getQualifierRange(), + Qualifier); + else + E = new (Context) DeclRefExpr(Fn, Fn->getType(), + TID->getTemplateNameLoc()); + TID->Destroy(Context); } else { assert(false && "Invalid reference to overloaded function");