diff options
-rw-r--r-- | ext/XS-APItest/t/newCONSTSUB.t | 13 | ||||
-rw-r--r-- | op.c | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ext/XS-APItest/t/newCONSTSUB.t b/ext/XS-APItest/t/newCONSTSUB.t index 4a2edd62ab..286f9a2375 100644 --- a/ext/XS-APItest/t/newCONSTSUB.t +++ b/ext/XS-APItest/t/newCONSTSUB.t @@ -4,7 +4,7 @@ use strict; use warnings; use utf8; use open qw( :utf8 :std ); -use Test::More "no_plan"; +use Test::More tests => 9; use XS::APItest; @@ -22,3 +22,14 @@ ok !$::{"\x{30cb}"}, "...but not the right one"; ok $const, "newCONSTSUB_flags generates the constant,"; ok *{$glob}{CODE}, "..and the glob,"; ok $::{"\x{30cd}"}, "...the right one!"; + +eval q{ + BEGIN { + no warnings; + my $w; + local $SIG{__WARN__} = sub { $w .= shift }; + *foo = sub(){123}; + newCONSTSUB_type(\%::, "foo", 0, 1); + is $w, undef, 'newCONSTSUB uses calling scope for redefinition warnings'; + } +}; @@ -6938,6 +6938,8 @@ Perl_newCONSTSUB_flags(pTHX_ HV *stash, const char *name, STRLEN len, * an op shared between threads. Use a non-shared COP for our * dirty work */ SAVEVPTR(PL_curcop); + SAVECOMPILEWARNINGS(); + PL_compiling.cop_warnings = DUP_WARNINGS(PL_curcop->cop_warnings); PL_curcop = &PL_compiling; } SAVECOPLINE(PL_curcop); |