This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't localise array / hash slice ref assignment
authorDavid Mitchell <davem@iabyn.com>
Mon, 5 Nov 2018 12:29:27 +0000 (12:29 +0000)
committerDavid Mitchell <davem@iabyn.com>
Mon, 5 Nov 2018 12:29:27 +0000 (12:29 +0000)
commitb97fe865adca6799771c93fc17e9f36ae7272e72
treeaf325b560ea90f9b6f8bb927a4b823fc08d7408e
parent328d9079796a9f9f8dfb4813f36e50e8a77a0748
Don't localise array / hash slice ref assignment

RT #133538

The experimental ref assignment aliasing feature, when applied to
array or hash slices, was treating the slice as if it was always localized;
e.g.

    \(@a[3,5,7]) = \(....);

was being interpreted as

    local \(@a[3,5,7]) = \(....);

The fix is simple: check for the OPpLVAL_INTRO flag actually being set
on the op, rather than unconditionally localising the array/hash
elements.
pp.c
t/op/lvref.t