diff options
-rw-r--r-- | op.c | 2 | ||||
-rw-r--r-- | t/lib/warnings/pad | 15 |
2 files changed, 16 insertions, 1 deletions
@@ -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 bf5c367fc9..54d72cdef9 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. |