Robin Barker)
p4raw-id: //depot/perl@5965
}
}
else if (!CvUNIQUE(PL_compcv)) {
- if (ckWARN(WARN_CLOSURE) && !SvFAKE(sv) && !CvUNIQUE(cv))
+ if (ckWARN(WARN_CLOSURE) && !SvFAKE(sv) && !CvUNIQUE(cv)
+ && !(SvFLAGS(sv) & SVpad_OUR))
+ {
Perl_warner(aTHX_ WARN_CLOSURE,
"Variable \"%s\" will not stay shared", name);
+ }
}
}
av_store(PL_comppad, newoff, SvREFCNT_inc(oldsv));
# op.c
use warnings 'closure' ;
sub x {
+ our $x;
+ sub y {
+ $x
+ }
+ }
+EXPECT
+
+########
+# op.c
+use warnings 'closure' ;
+sub x {
my $x;
sub y {
sub { $x }