From: Dave Mitchell Date: Thu, 7 Aug 2003 15:53:35 +0000 (+0100) Subject: Fwd: Re: [PATCH] flags set incorrectly on abandoned lexicals X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2740392c45d51e34cd904b51afcc00544a78cf82;p=p5sagit%2Fp5-mst-13.2.git Fwd: Re: [PATCH] flags set incorrectly on abandoned lexicals Message-ID: <20030807145335.GF26683@fdgroup.com> p4raw-id: //depot/perl@20559 --- diff --git a/scope.c b/scope.c index 673a312..ff45b0d 100644 --- 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: diff --git a/t/lib/warnings/pad b/t/lib/warnings/pad index 65f92c3..441fba2 100644 --- a/t/lib/warnings/pad +++ b/t/lib/warnings/pad @@ -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 {