{
/* Redefining a sub - warning is mandatory if
it was a const and its value changed. */
- if (ckWARN(WARN_REDEFINE)
+ if (CvCONST(cv) && CvCONST((CV*)sref)
+ && cv_const_sv(cv)
+ == cv_const_sv((CV*)sref)) {
+ /* They are 2 constant subroutines
+ generated from the same constant.
+ This probably means that they are
+ really the "same" proxy subroutine
+ instantiated in 2 places. Most likely
+ this is when a constant is exported
+ twice. Don't warn. */
+ }
+ else if (ckWARN(WARN_REDEFINE)
|| (CvCONST(cv)
&& (!CvCONST((CV*)sref)
|| sv_cmp(cv_const_sv(cv),
my $w = '';
local $SIG{__WARN__} = sub { $w = $_[0] };
$result = *{$gr} = \&{"oonk"};
- like($w, qr/^Constant subroutine main::plunk redefined/,
- "Redefining a constant sub should warn");
+ is($w, '', "Redefining a constant sub to another constant sub with the same underlying value should not warn (It's just re-exporting, and that was always legal)");
}
is (ref $::{oonk}, 'SCALAR', "Export doesn't affect original");