This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #128187] Forbid sub :lvalue{keys} in aassign
authorFather Chrysostomos <sprout@cpan.org>
Fri, 20 May 2016 01:27:24 +0000 (18:27 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 20 May 2016 22:56:38 +0000 (15:56 -0700)
commita061ab0bf2cb11304132a96f31a2b0403912e9b6
treec6a541f3dd74d6505c19605a7b48e94c2afb98d0
parent5ad999257778c656213e977c2fd782e515f02bad
[perl #128187] Forbid sub :lvalue{keys} in aassign

This commit makes perl die when keys(%hash) is returned from an lvalue
sub and the lvalue sub call is assigned to in list assignment:

    sub foo : lvalue { keys(%INC) }
    (foo) = 3; # death

This prevents an assignment that is completely useless and probably a
mistake, and it makes the lvalue-sub use of keys behave the same way
as (keys(%INC)) = 3.
doop.c
t/op/sub_lval.t