From: Gurusamy Sarathy Date: Sun, 28 May 2000 08:46:10 +0000 (+0000) Subject: fix bogus redeclaration warning for "our" variables in different X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5ce0178e8e6a35225316965a9dccd12fa35eb60d;p=p5sagit%2Fp5-mst-13.2.git fix bogus redeclaration warning for "our" variables in different scopes p4raw-id: //depot/perl@6137 --- diff --git a/op.c b/op.c index 3275d0e..6e77fde 100644 --- a/op.c +++ b/op.c @@ -162,6 +162,7 @@ Perl_pad_allocmy(pTHX_ char *name) do { if ((sv = svp[off]) && sv != &PL_sv_undef + && (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0) && ((SvFLAGS(sv) & SVpad_OUR) && GvSTASH(sv) == ourstash) && strEQ(name, SvPVX(sv))) { diff --git a/t/pragma/strict-vars b/t/pragma/strict-vars index a764fb2..5ba579d 100644 --- a/t/pragma/strict-vars +++ b/t/pragma/strict-vars @@ -387,6 +387,8 @@ EXPECT # multiple our declarations in same scope, same package, warning use strict 'vars'; use warnings; +{ our $x = 1 } +{ our $x = 0 } our $foo; { our $foo; @@ -394,9 +396,9 @@ our $foo; our $foo; } EXPECT -"our" variable $foo redeclared at - line 7. +"our" variable $foo redeclared at - line 9. (Did you mean "local" instead of "our"?) -Name "Foo::foo" used only once: possible typo at - line 9. +Name "Foo::foo" used only once: possible typo at - line 11. ######## # Make sure the strict vars failure still occurs