else {
if (ckWARN(WARN_VOID)) {
useless = "a constant";
+ if (o->op_private & OPpCONST_ARYBASE)
+ useless = 0;
/* don't warn on optimised away booleans, eg
* use constant Foo, 5; Foo || print; */
if (cSVOPo->op_private & OPpCONST_SHORTCIRCUIT)
PL_modcount++;
return o;
case OP_CONST:
- if (!(o->op_private & (OPpCONST_ARYBASE)))
+ if (!(o->op_private & OPpCONST_ARYBASE))
goto nomod;
localize = 0;
if (PL_eval_start && PL_eval_start->op_type == OP_CONST) {
PL_eval_start = 0;
else {
o = newSVOP(OP_CONST, 0, newSViv(PL_compiling.cop_arybase));
+ o->op_private |= OPpCONST_ARYBASE;
}
}
return o;
5 || print "bad\n"; # test OPpCONST_SHORTCIRCUIT
use constant U => undef;
print "boo\n" if U; # test OPpCONST_SHORTCIRCUIT
+$[ = 2; # should not warn
no warnings 'void' ;
"abc"; # OP_CONST
7 ; # OP_CONST