diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 6a198f94e4..1c74b121e8 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -4358,6 +4358,7 @@ static VALUE vm_opt_regexpmatch2(VALUE recv, VALUE obj) { if (CLASS_OF(recv) == rb_cString && + CLASS_OF(obj) == rb_cRegexp && BASIC_OP_UNREDEFINED_P(BOP_MATCH, STRING_REDEFINED_OP_FLAG)) { return rb_reg_match(obj, recv); }