This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix explicit return of pad var in list lv context
authorFather Chrysostomos <sprout@cpan.org>
Thu, 23 Jun 2011 16:44:45 +0000 (09:44 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 23 Jun 2011 17:23:45 +0000 (10:23 -0700)
commit4bee03f8e20d4e5257132fdea9f9fac4206c79f8
tree622f6406d363cda9f90958b6698c272ffac4c41a
parent0accd0eeebd92a8877c7f7ecc13c7cb3ec364faa
Fix explicit return of pad var in list lv context

This is something that commit e08be60 missed, though it never worked
properly, even in 5.14, as explicit return from lvalue subs used to
copy return values.

As the commit message for e08be60 states, returning a scalar itself
from an lvalue sub does not work if it is a pad variable with a refer-
ence count of 1, because the sub-popping code clears it on exit.

The one code path that did not account for this was list lvalue con-
text (real lvalue context, not just potentially lvalue).  The only
observable effect this has is that assigning to a magic pad variable
returned from a subroutine in list context will not trigger set-magic.

This commit fixes it and also adds tests for returned magic pad vars
in all combinations of list/scalar lvalue/ref context.
pod/perldelta.pod
pp_ctl.c
t/op/sub_lval.t