@@ -13068,48 +13068,8 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr(UnresolvedLookupExpr *Old,
13068
13068
R.setNamingClass(NamingClass);
13069
13069
}
13070
13070
13071
+ // Rebuild the template arguments, if any.
13071
13072
SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
13072
-
13073
- #if 0
13074
- // If we have neither explicit template arguments, nor the template keyword,
13075
- // it's a normal declaration name or member reference.
13076
- if (!Old->hasExplicitTemplateArgs() && !TemplateKWLoc.isValid()) {
13077
- NamedDecl *D = R.getAsSingle<NamedDecl>();
13078
- // In a C++11 unevaluated context, an UnresolvedLookupExpr might refer to an
13079
- // instance member. In other contexts, BuildPossibleImplicitMemberExpr will
13080
- // give a good diagnostic.
13081
- if (D && D->isCXXInstanceMember()) {
13082
- return SemaRef.BuildPossibleImplicitMemberExpr(SS, TemplateKWLoc, R,
13083
- /*TemplateArgs=*/nullptr,
13084
- /*Scope=*/nullptr);
13085
- }
13086
-
13087
- return getDerived().RebuildDeclarationNameExpr(SS, R, Old->requiresADL());
13088
- }
13089
- #endif
13090
-
13091
- bool PotentiallyImplicitAccess =
13092
- #if 0
13093
- R.isClassLookup() &&
13094
- (!IsAddressOfOperand ||
13095
- (R.isSingleResult() &&
13096
- R.getAsSingle<NamedDecl>()->isCXXInstanceMember()));
13097
- #elif 0
13098
- !IsAddressOfOperand && !R.empty() && R.begin()->isCXXClassMember();
13099
- #elif 1
13100
- SemaRef.isPotentialImplicitMemberAccess(SS, R, IsAddressOfOperand);
13101
- #endif
13102
-
13103
-
13104
- // If we have neither explicit template arguments, nor the template keyword,
13105
- // it's a normal declaration name or member reference.
13106
- if (!PotentiallyImplicitAccess && !Old->hasExplicitTemplateArgs() &&
13107
- !TemplateKWLoc.isValid()) {
13108
- return getDerived().RebuildDeclarationNameExpr(SS, R, Old->requiresADL());
13109
- }
13110
-
13111
- // If we have template arguments, rebuild them, then rebuild the
13112
- // templateid expression.
13113
13073
TemplateArgumentListInfo TransArgs(Old->getLAngleLoc(), Old->getRAngleLoc());
13114
13074
if (Old->hasExplicitTemplateArgs() &&
13115
13075
getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
@@ -13119,16 +13079,23 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr(UnresolvedLookupExpr *Old,
13119
13079
return ExprError();
13120
13080
}
13121
13081
13122
- // In a C++11 unevaluated context, an UnresolvedLookupExpr might refer to an
13123
- // instance member. In other contexts, BuildPossibleImplicitMemberExpr will
13124
- // give a good diagnostic.
13125
- if (PotentiallyImplicitAccess) {
13082
+ // An UnresolvedLookupExpr can refer to a class member. This occurs e.g. when
13083
+ // a non-static data member is named in an unevaluated operand, or when
13084
+ // a member is named in a dependent class scope function template explicit
13085
+ // specialization that is neither declared static nor with an explicit object
13086
+ // parameter.
13087
+ if (SemaRef.isPotentialImplicitMemberAccess(SS, R, IsAddressOfOperand))
13126
13088
return SemaRef.BuildPossibleImplicitMemberExpr(
13127
13089
SS, TemplateKWLoc, R,
13128
13090
Old->hasExplicitTemplateArgs() ? &TransArgs : nullptr,
13129
- /*Scope=*/nullptr);
13130
- }
13091
+ /*S=*/nullptr);
13092
+
13093
+ // If we have neither explicit template arguments, nor the template keyword,
13094
+ // it's a normal declaration name or member reference.
13095
+ if (!Old->hasExplicitTemplateArgs() && !TemplateKWLoc.isValid())
13096
+ return getDerived().RebuildDeclarationNameExpr(SS, R, Old->requiresADL());
13131
13097
13098
+ // If we have template arguments, then rebuild the template-id expression.
13132
13099
return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
13133
13100
Old->requiresADL(), &TransArgs);
13134
13101
}
0 commit comments