Commit
b9ad13acb3 caused case SVt_REGEXP in sv_upgrade to fall
through to the assertions under case SVt_PVIV that are not relevant to
SVt_REGEXP.
We should really be setting the FAKE flag when actually making a sca-
lar a regexp, rather than in sv_upgrade. (I will probably need it
there in future commits, too, since it really should be possible for
SVt_PVLVs to hold regular expressions.)
if (!ret_x)
ret_x = (REGEXP*) newSV_type(SVt_REGEXP);
+ /* This ensures that SvTHINKFIRST(sv) is true, and hence that
+ sv_force_normal(sv) is called. */
+ SvFAKE_on(ret_x);
ret = (struct regexp *)SvANY(ret_x);
(void)ReREFCNT_inc(rx);
}
break;
-
- case SVt_REGEXP:
- /* This ensures that SvTHINKFIRST(sv) is true, and hence that
- sv_force_normal_flags(sv) is called. */
- SvFAKE_on(sv);
case SVt_PVIV:
/* XXX Is this still needed? Was it ever needed? Surely as there is
no route from NV to PVIV, NOK can never be true */
case SVt_PVGV:
case SVt_PVCV:
case SVt_PVLV:
+ case SVt_REGEXP:
case SVt_PVMG:
case SVt_PVNV:
case SVt_PV:
require './test.pl';
}
-plan(tests => 20);
+plan(tests => 21);
sub r {
return qr/Good/;
$_ = "bar";
$_ =~ s/${qr||}/baz/;
is $_, "bazbar", '[perl #96230] s/$qr// does not reuse last pat';
+
+{
+ my $x = 1.1; $x = ${qr//};
+ pass 'no assertion failure when upgrading NV to regexp';
+}