use strict;
use Config;
-print "1..37\n";
+print "1..39\n";
use B::Deparse;
my $deparse = B::Deparse->new() or print "not ";
print "# [$a]\n\# vs expected\n# [$b]\nnot " if $a ne $b;
print "ok " . $i++ . "\n";
+#Re: perlbug #35857, patch #24505
+#handle warnings::register-ed packages properly.
+package B::Deparse::Wrapper;
+use strict;
+use warnings;
+use warnings::register;
+sub getcode {
+ my $deparser=B::Deparse->new();
+ return $deparser->coderef2text(shift);
+}
+
+package main;
+use strict;
+use warnings;
+sub test {
+ my $val=shift;
+ my $res=B::Deparse::Wrapper::getcode($val);
+ print $res=~/use warnings/ ? '' : 'not ',"ok\n";
+}
+my ($q,$p);
+my $x=sub { ++$q,++$p };
+test($x);
+eval <<EOFCODE and test($x);
+ package bar;
+ use strict;
+ use warnings;
+ use warnings::register;
+ package main;
+ 1
+EOFCODE
+
__DATA__
# 2
1;