NamedDecl *Result = nullptr;
// FIXME: If the name is a dependent name, this lookup won't necessarily
// find it. Does that ever matter?
- if (D->getDeclName()) {
- DeclContext::lookup_result Found = ParentDC->lookup(D->getDeclName());
+ if (auto Name = D->getDeclName()) {
+ DeclarationNameInfo NameInfo(Name, D->getLocation());
+ Name = SubstDeclarationNameInfo(NameInfo, TemplateArgs).getName();
+ if (!Name)
+ return nullptr;
+ DeclContext::lookup_result Found = ParentDC->lookup(Name);
Result = findInstantiationOf(Context, D, Found.begin(), Found.end());
} else {
// Since we don't have a name for the entity we're looking for,
// base (and therefore couldn't do the check) and a
// nested-name-qualifier (and therefore could do the lookup).
NamedDecl *FirstQualifierInScope = nullptr;
+ DeclarationNameInfo MemberNameInfo = E->getMemberNameInfo();
+ if (MemberNameInfo.getName()) {
+ MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
+ if (!MemberNameInfo.getName())
+ return ExprError();
+ }
return getDerived().RebuildMemberExpr(Base.get(), FakeOperatorLoc,
E->isArrow(),
QualifierLoc,
TemplateKWLoc,
- E->getMemberNameInfo(),
+ MemberNameInfo,
Member,
FoundDecl,
(E->hasExplicitTemplateArgs()