This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Warn by default for constant my sub redefinition
[perl5.git] / op.c
diff --git a/op.c b/op.c
index 0e287e1..871982c 100644 (file)
--- a/op.c
+++ b/op.c
@@ -7056,7 +7056,7 @@ Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
            else {
                /* redundant check that avoids creating the extra SV
                   most of the time: */
-               if (const_sv || ckWARN(WARN_REDEFINE)) {
+               if (CvCONST(cv) || ckWARN(WARN_REDEFINE)) {
                    const line_t oldline = CopLINE(PL_curcop);
                    SV *noamp = sv_2mortal(newSVpvn_utf8(
                                    PadnamePV(name)+1,PadnameLEN(name)-1,