From: Nicholas Clark Date: Thu, 12 Nov 2009 17:19:48 +0000 (+0000) Subject: As our $_; is forced into main::, it should warn as a redeclaration. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1456f9252e5c8bd47baf9395f629cf32d81766f1;p=p5sagit%2Fp5-mst-13.2.git As our $_; is forced into main::, it should warn as a redeclaration. --- diff --git a/op.c b/op.c index b1e8c90..dcecdb6 100644 --- a/op.c +++ b/op.c @@ -408,7 +408,7 @@ Perl_allocmy(pTHX_ const char *const name, const STRLEN len, const U32 flags) /* check for duplicate declaration */ pad_check_dup(name, len, is_our ? pad_add_OUR : 0, - (PL_curstash ? PL_curstash : PL_defstash)); + (PL_curstash && !strEQ(name,"$_") ? PL_curstash : PL_defstash)); /* allocate a spare slot and store the name in that slot */ diff --git a/t/lib/warnings/pad b/t/lib/warnings/pad index bf5c367..54d72cd 100644 --- a/t/lib/warnings/pad +++ b/t/lib/warnings/pad @@ -312,3 +312,18 @@ use strict; use warnings; our $x unless $x; EXPECT +######## +use warnings 'misc'; +our $qunckkk; +our $_; +package clank_est; +our $qunckkk; +our $_; +no warnings 'misc'; +our $ouch; +our $_; +package whack; +our $ouch; +our $_; +EXPECT +"our" variable $_ redeclared at - line 6.