[perl #25147] C<use strict; print if foo> didn't give the
Dave Mitchell [Thu, 22 Jan 2004 00:24:51 +0000 (00:24 +0000)]
"Bareword not allowed" error unless warnings were enabled

p4raw-id: //depot/perl@22194

op.c

diff --git a/op.c b/op.c
index d53b130..b902fed 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3343,12 +3343,10 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
        }
     }
     if (first->op_type == OP_CONST) {
-       if (ckWARN(WARN_BAREWORD) && (first->op_private & OPpCONST_BARE)) {
-           if (first->op_private & OPpCONST_STRICT)
-               no_bareword_allowed(first);
-           else
+       if (first->op_private & OPpCONST_STRICT)
+           no_bareword_allowed(first);
+       else if (ckWARN(WARN_BAREWORD) && (first->op_private & OPpCONST_BARE))
                Perl_warner(aTHX_ packWARN(WARN_BAREWORD), "Bareword found in conditional");
-       }
        if ((type == OP_AND) == (SvTRUE(((SVOP*)first)->op_sv))) {
            op_free(first);
            *firstp = Nullop;