diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb index 846d8e36a9..a5ea35dd4b 100644 --- a/bootstraptest/test_method.rb +++ b/bootstraptest/test_method.rb @@ -1344,3 +1344,18 @@ assert_equal 'ok', %q{ C.new.foo } + +assert_equal 'ok', %q{ + class C + def initialize(a) + end + end + + def foo(...) + C.new(...) + :ok + end + + foo(*["bar"]) + foo("baz") +} diff --git a/vm_insnhelper.c b/vm_insnhelper.c index be43e737fe..88feba74b9 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -3907,7 +3907,7 @@ vm_call_cfunc(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb const struct rb_callinfo *ci = calling->cd->ci; RB_DEBUG_COUNTER_INC(ccf_cfunc); - if (IS_ARGS_SPLAT(ci)) { + if (IS_ARGS_SPLAT(ci) && !(vm_ci_flag(ci) & VM_CALL_FORWARDING)) { if (!IS_ARGS_KW_SPLAT(ci) && vm_ci_argc(ci) == 1) { // f(*a) CC_SET_FASTPATH(calling->cc, vm_call_cfunc_only_splat, TRUE);