@@ -1455,8 +1455,8 @@ void Converter::ConvertGenericCallExpr(clang::CallExpr *expr) {
14551455 if (proto && !function) {
14561456 EmitFnPtrCall (callee);
14571457 } else {
1458- PushExprKind push (*this , ExprKind::RValue );
1459- Convert (StripFunctionPointerDecay ( callee) );
1458+ PushExprKind push (*this , ExprKind::Callee );
1459+ Convert (callee);
14601460 }
14611461 StrCat (token::kOpenParen );
14621462 for (unsigned i = 0 ; i < num_named_params && i < num_args; ++i) {
@@ -1674,8 +1674,12 @@ bool Converter::VisitImplicitCastExpr(clang::ImplicitCastExpr *expr) {
16741674 }
16751675 case clang::CastKind::CK_FunctionToPointerDecay:
16761676 case clang::CastKind::CK_BuiltinFnToFnPtr: {
1677- PushExprKind push (*this , ExprKind::AddrOf);
1678- Convert (sub_expr);
1677+ if (isCallee ()) {
1678+ Convert (sub_expr);
1679+ } else {
1680+ PushExprKind push (*this , ExprKind::AddrOf);
1681+ Convert (sub_expr);
1682+ }
16791683 break ;
16801684 }
16811685 case clang::CastKind::CK_ConstructorConversion:
@@ -3234,7 +3238,12 @@ void Converter::PlaceholderCtx::dump() const {
32343238
32353239std::string Converter::ConvertPlaceholder (clang::Expr *expr, clang::Expr *arg,
32363240 const PlaceholderCtx &ph_ctx) {
3237- arg = StripFunctionPointerDecay (arg);
3241+ if (arg->getType ()->isFunctionPointerType ()) {
3242+ PushExprKind push (*this , ExprKind::Callee);
3243+ Buffer buf (*this );
3244+ Convert (arg);
3245+ return std::move (buf).str ();
3246+ }
32383247
32393248 if (ph_ctx.needs_materialization ()) {
32403249 auto materialized = ph_ctx.materialize_ctx ->GetOrMaterialize (
@@ -3383,6 +3392,10 @@ bool Converter::isVoid() const {
33833392 return curr_expr_kind_.empty () || curr_expr_kind_.back () == ExprKind::Void;
33843393}
33853394
3395+ bool Converter::isCallee () const {
3396+ return !curr_expr_kind_.empty () && curr_expr_kind_.back () == ExprKind::Callee;
3397+ }
3398+
33863399void Converter::SetFresh () {
33873400 switch (computed_expr_type_) {
33883401 case ComputedExprType::Value:
0 commit comments