If $a+$b produces a mutable value, then so should 1+2.
chr(256).chr(0).chr(512),
'SV = PV\\($ADDR\\) at $ADDR
REFCNT = 1
- FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\)
+ FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\) # $] < 5.019002
+ FLAGS = \\((?:$PADTMP,)?POK,pPOK,UTF8\\) # $] >=5.019002
PV = $ADDR "\\\214\\\101\\\0\\\235\\\101"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
CUR = 5
LEN = \\d+');
chr(256).chr(0).chr(512),
'SV = PV\\($ADDR\\) at $ADDR
REFCNT = 1
- FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\)
+ FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\) # $] < 5.019002
+ FLAGS = \\((?:$PADTMP,)?POK,pPOK,UTF8\\) # $] >=5.019002
PV = $ADDR "\\\304\\\200\\\0\\\310\\\200"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
CUR = 5
LEN = \\d+');
op_free(o);
#endif
assert(sv);
+ if (!SvIMMORTAL(sv)) SvPADTMP_on(sv);
if (type == OP_RV2GV)
newop = newGVOP(OP_GV, 0, MUTABLE_GV(sv));
else
print "not " unless $_ eq 4;
print "ok ", ++$test,
" - 1+2 returns mutable value, just like \$a+\$b",
- " # TODO\n";
+ "\n";
}
# [perl #19566]: sv_gets writes directly to its argument via
# TARG. Test that we respect SvREADONLY.
-eval { for (\2) { $_ = <FH> } };
+use constant roref => \2;
+eval { for (roref) { $_ = <FH> } };
like($@, 'Modification of a read-only value attempted', '[perl #19566]');
# [perl #21628]
}
is($destroyed, 1, 'Timely scalar destruction with lvalue vec');
-eval { for (\1) { vec($_,0,1) = 1 } };
+use constant roref => \1;
+eval { for (roref) { vec($_,0,1) = 1 } };
like($@, qr/^Modification of a read-only value attempted at /,
'err msg when modifying read-only refs');
# [perl #19566]: sv_gets writes directly to its argument via
# TARG. Test that we respect SvREADONLY.
-eval { for (\2) { $_ = <Fʜ> } };
+use constant roref=>\2;
+eval { for (roref) { $_ = <Fʜ> } };
like($@, 'Modification of a read-only value attempted', '[perl #19566]');
# [perl #21628]