summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-06-04 11:38:02 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-06-04 14:34:30 -0700
commita130272381198bb249482fb77a994df28ddaf3bf (patch)
treee92e410cfe23ab013f2ee23aae51110e4936988c /pp_hot.c
parenta8c75f4be1d24785526e639ef648a2b7906a61cc (diff)
downloadperl-a130272381198bb249482fb77a994df28ddaf3bf.tar.gz
Allow lvalue subs to return COWs in reference context
(That’s ‘reference’ as in ‘pass by reference’. It applies to foo(lvalue_func()) and for(lvalue_func()).) Commit f71f472 took care of scalar context. Commit a0aa607 came and long and took care of list context, but, unfortunately, missed reference context. This commit takes care of that.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 34c493baab..cd556f3f2a 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2697,7 +2697,9 @@ PP(pp_leavesublv)
for (mark = newsp + 1; mark <= SP; mark++) {
if (SvTEMP(*mark))
NOOP;
- else if (SvFLAGS(*mark) & (SVs_PADTMP | SVf_READONLY))
+ else if (SvFLAGS(*mark) & SVs_PADTMP
+ || (SvFLAGS(*mark) & (SVf_READONLY|SVf_FAKE))
+ == SVf_READONLY)
*mark = sv_mortalcopy(*mark);
else {
/* Can be a localized value subject to deletion. */