summaryrefslogtreecommitdiff
path: root/t
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 /t
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 't')
-rw-r--r--t/op/sub_lval.t5
1 files changed, 4 insertions, 1 deletions
diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t
index db9806b04c..a149a38614 100644
--- a/t/op/sub_lval.t
+++ b/t/op/sub_lval.t
@@ -3,7 +3,7 @@ BEGIN {
@INC = '../lib';
require './test.pl';
}
-plan tests=>149;
+plan tests=>151;
sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary
sub b : lvalue { ${\shift} }
@@ -712,6 +712,9 @@ is $pnare, 1, 'and returning CATTLE actually works';
$pnare = __PACKAGE__;
ok eval { (fleen) = 1 }, "lvalues can return COWs in list context";
is $pnare, 1, 'and returning COWs in list context actually works';
+$pnare = __PACKAGE__;
+ok eval { $_ = 1 for(fleen); 1 }, "lvalues can return COWs in ref cx";
+is $pnare, 1, 'and returning COWs in reference context actually works';
# Returning an arbitrary expression, not necessarily lvalue