@@ -13957,6 +13957,23 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
13957
13957
CurFPFeatureOverrides());
13958
13958
}
13959
13959
13960
+ // If this is the .* operator, which is not overloadable, just
13961
+ // create a built-in binary operator.
13962
+ if (Opc == BO_PtrMemD) {
13963
+ auto CheckPlaceholder = [&](Expr *&Arg) {
13964
+ ExprResult Res = CheckPlaceholderExpr(Arg);
13965
+ if (Res.isUsable())
13966
+ Arg = Res.get();
13967
+ return !Res.isUsable();
13968
+ };
13969
+
13970
+ // CreateBuiltinBinOp() doesn't like it if we tell it to create a '.*'
13971
+ // expression that contains placeholders (in either the LHS or RHS).
13972
+ if (CheckPlaceholder(Args[0]) || CheckPlaceholder(Args[1]))
13973
+ return ExprError();
13974
+ return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
13975
+ }
13976
+
13960
13977
// Always do placeholder-like conversions on the RHS.
13961
13978
if (checkPlaceholderForOverload(*this, Args[1]))
13962
13979
return ExprError();
@@ -13976,11 +13993,6 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
13976
13993
if (Opc == BO_Assign && !Args[0]->getType()->isOverloadableType())
13977
13994
return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
13978
13995
13979
- // If this is the .* operator, which is not overloadable, just
13980
- // create a built-in binary operator.
13981
- if (Opc == BO_PtrMemD)
13982
- return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
13983
-
13984
13996
// Build the overload set.
13985
13997
OverloadCandidateSet CandidateSet(OpLoc, OverloadCandidateSet::CSK_Operator,
13986
13998
OverloadCandidateSet::OperatorRewriteInfo(
0 commit comments