/* Take a copy since we're about to overwrite TARG */
olds = s = (U8*)savepvn((char*)s, len);
}
- if (!SvOK(left) && SvTYPE(left) <= SVt_PVMG)
- sv_setpv(left, ""); /* Suppress warning. */
+ if (!SvOK(left) && SvTYPE(left) <= SVt_PVMG) {
+ if (SvREADONLY(left)) {
+ left = sv_2mortal(newSVpvn("", 0));
+ left_utf = FALSE;
+ }
+ else
+ sv_setpv(left, ""); /* Suppress warning. */
+ }
l = (U8*)SvPV(left, targlen);
left_utf |= DO_UTF8(left);
if (TARG != left)
}
}
-print "1..99\n";
+print "1..101\n";
my $test = 1;
$test++;
}
}
+
+{
+ # ID 20001020.006
+
+ "x" =~ /(.)/; # unset $2
+
+ # Without the fix this will croak:
+ # Modification of a read-only value attempted at ...
+ "$2\x{1234}";
+
+ print "ok $test\n";
+ $test++;
+
+ # For symmetry with the above.
+ "\x{1234}$2";
+
+ print "ok $test\n";
+ $test++;
+}