This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fwd: Re: [PATCH] flags set incorrectly on abandoned lexicals
authorDave Mitchell <davem@fdisolutions.com>
Thu, 7 Aug 2003 15:53:35 +0000 (16:53 +0100)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 7 Aug 2003 19:59:18 +0000 (19:59 +0000)
Message-ID: <20030807145335.GF26683@fdgroup.com>

p4raw-id: //depot/perl@20559

scope.c
t/lib/warnings/pad

diff --git a/scope.c b/scope.c
index 673a312..ff45b0d 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -945,7 +945,7 @@ Perl_leave_scope(pTHX_ I32 base)
                SvREFCNT_dec(sv);       /* Cast current value to the winds. */
                /* preserve pad nature, but also mark as not live
                 * for any closure capturing */
-               SvFLAGS(*(SV**)ptr) |= padflags & SVs_PADSTALE;
+               SvFLAGS(*(SV**)ptr) |= padflags | SVs_PADSTALE;
            }
            break;
        case SAVEt_DELETE:
index 65f92c3..441fba2 100644 (file)
@@ -149,6 +149,16 @@ f()->();
 EXPECT
 Variable "$x" is not available at (eval 1) line 2.
 ########
+use warnings 'closure' ;
+{
+    my $x = 1;
+    $y = \$x; # force abandonment rather than clear-in-place at scope exit
+    sub f2 { eval '$x' }
+}
+f2();
+EXPECT
+Variable "$x" is not available at (eval 1) line 2.
+########
 # pad.c
 no warnings 'closure' ;
 sub x {