diff options
Diffstat (limited to 't/op/sub_lval.t')
-rw-r--r-- | t/op/sub_lval.t | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t index de4a8cc17a..a9ff88b087 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=>151; +plan tests=>155; sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary sub b : lvalue { ${\shift} } @@ -786,3 +786,14 @@ for my $sub (sub :lvalue {$_}, sub :lvalue {return $_}) { is join('-',%$_), '4-5', '%{func()} autovivification'.$suffix; } continue { $suffix = ' (explicit return)' } + +# [perl #92406] [perl #92290] Returning a pad var in rvalue context +$suffix = ''; +for my $sub ( + sub :lvalue { my $x = 72; $x }, + sub :lvalue { my $x = 72; return $x } +) { + is scalar(&$sub), 72, "sub returning pad var in scalar context$suffix"; + is +(&$sub)[0], 72, "sub returning pad var in list context$suffix"; +} +continue { $suffix = ' (explicit return)' } |