This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
test that pp_leavesub copies returned PADTMPs.
authorDavid Mitchell <davem@iabyn.com>
Wed, 21 Oct 2015 16:54:29 +0000 (17:54 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:18:32 +0000 (09:18 +0000)
Although pp_leavesub() has in fact always done this, it was never actually
tested for.

t/op/sub.t

index 380334b..cc6501d 100644 (file)
@@ -6,7 +6,7 @@ BEGIN {
     set_up_inc('../lib');
 }
 
-plan(tests => 60);
+plan(tests => 61);
 
 sub empty_sub {}
 
@@ -383,3 +383,11 @@ is(join('-', 10, check_ret(-1,5)),      "10",  "check_ret(-1,5) list");
     }->('a','b');
     is(join('-', @res), "a-b", "unnested rubbish");
 }
+
+# a sub should copy returned PADTMPs
+
+{
+    sub f99 { $_[0] . "x" };
+    my $a = [ f99(1), f99(2) ];
+    is("@$a", "1x 2x", "PADTMPs copied on return");
+}