@@ -3224,6 +3224,7 @@ ExprResult Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
32243224 if (!NeedsADL && R.isSingleResult() &&
32253225 !R.getAsSingle<FunctionTemplateDecl>() &&
32263226 !ShouldLookupResultBeMultiVersionOverload(R))
3227+ // FIXME: get ConvertedArgs
32273228 return BuildDeclarationNameExpr(SS, R.getLookupNameInfo(), R.getFoundDecl(),
32283229 R.getRepresentativeDecl(), nullptr, nullptr,
32293230 AcceptInvalidDecl);
@@ -3308,6 +3309,10 @@ ExprResult Sema::BuildDeclarationNameExpr(
33083309 QualType type = VD->getType();
33093310 if (type.isNull())
33103311 return ExprError();
3312+ assert(!TemplateArgs || ConvertedArgs);
3313+ type = ConvertedArgs
3314+ ? resugar(SS.getScopeRep(), VD, ConvertedArgs->asArray(), type)
3315+ : resugar(SS.getScopeRep(), type);
33113316 ExprValueKind valueKind = VK_PRValue;
33123317
33133318 // In 'T ...V;', the type of the declaration 'V' is 'T...', but the type of
@@ -19895,10 +19900,30 @@ static void DoMarkVarDeclReferenced(
1989519900
1989619901 // Re-set the member to trigger a recomputation of the dependence bits
1989719902 // for the expression.
19898- if (auto *DRE = dyn_cast_or_null<DeclRefExpr>(E))
19903+ CXXScopeSpec SS;
19904+ if (auto *DRE = dyn_cast_or_null<DeclRefExpr>(E)) {
1989919905 DRE->setDecl(DRE->getDecl());
19900- else if (auto *ME = dyn_cast_or_null<MemberExpr>(E))
19906+ SS.Adopt(DRE->getQualifierLoc());
19907+ assert(DRE->template_arguments().size() == 0 ||
19908+ DRE->getConvertedArgs() != nullptr);
19909+ QualType T = DRE->getConvertedArgs()
19910+ ? SemaRef.resugar(SS.getScopeRep(), DRE->getDecl(),
19911+ DRE->getConvertedArgs()->asArray(),
19912+ DRE->getType())
19913+ : SemaRef.resugar(SS.getScopeRep(), DRE->getType());
19914+ DRE->setType(T);
19915+ } else if (auto *ME = dyn_cast_or_null<MemberExpr>(E)) {
1990119916 ME->setMemberDecl(ME->getMemberDecl());
19917+ SS.Adopt(ME->getQualifierLoc());
19918+ assert(ME->template_arguments().size() == 0 ||
19919+ ME->getDeduced() != nullptr);
19920+ QualType T =
19921+ ME->getDeduced()
19922+ ? SemaRef.resugar(SS.getScopeRep(), ME->getMemberDecl(),
19923+ ME->getDeduced()->asArray(), ME->getType())
19924+ : SemaRef.resugar(SS.getScopeRep(), ME->getType());
19925+ ME->setType(T);
19926+ }
1990219927 } else if (FirstInstantiation) {
1990319928 SemaRef.PendingInstantiations
1990419929 .push_back(std::make_pair(Var, PointOfInstantiation));
@@ -21200,6 +21225,7 @@ ExprResult Sema::CheckPlaceholderExpr(Expr *E) {
2120021225 SS.Adopt(DRE->getQualifierLoc());
2120121226 TemplateArgumentListInfo TemplateArgs;
2120221227 DRE->copyTemplateArgumentsInto(TemplateArgs);
21228+ // FIXME: resugar
2120321229 return BuildDeclRefExpr(
2120421230 FD, FD->getType(), VK_LValue, DRE->getNameInfo(),
2120521231 DRE->hasQualifier() ? &SS : nullptr, DRE->getFoundDecl(),
0 commit comments