This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #126633] check children of OA_DANGEROUS ops for common scalars
authorDave Mitchell <davem@iabyn.com>
Thu, 7 Jan 2016 00:36:10 +0000 (11:36 +1100)
committerTony Cook <tony@develop-help.com>
Sun, 10 Jan 2016 22:12:59 +0000 (09:12 +1100)
Tony Cook: added tests

op.c
t/op/aassign.t

diff --git a/op.c b/op.c
index 1b78a4c..ee31adc 100644 (file)
--- a/op.c
+++ b/op.c
@@ -12343,7 +12343,8 @@ S_aassign_scan(pTHX_ OP* o, bool rhs, bool top, int *scalars_p)
     default:
         if (PL_opargs[o->op_type] & OA_DANGEROUS) {
             (*scalars_p) += 2;
-            return AAS_DANGEROUS;
+            flags = AAS_DANGEROUS;
+            break;
         }
 
         if (   (PL_opargs[o->op_type] & OA_TARGLEX)
index 03cc84c..e1c687c 100644 (file)
@@ -382,6 +382,14 @@ SKIP: {
     my $orig;
     ($proxy[0], $orig) = (1, $set);
     is($orig, 0, 'previous value of $set');
+
+    # from cpan #110278
+    use List::Util qw(min);
+    my $x = 1;
+    my $y = 2;
+    ( $x, $y ) = ( min($y), min($x) );
+    is($x, 2, "check swap for \$x");
+    is($y, 1, "check swap for \$y");
 }
 
 done_testing();