p4raw-id: //depot/perl@33309
no_bareword_allowed(o);
else {
if (ckWARN(WARN_VOID)) {
- SV* msv = sv_2mortal(Perl_newSVpvf(aTHX_ "a constant (%"SVf")", sv));
- useless = SvPV_nolen(msv);
+ if (SvOK(sv)) {
+ SV* msv = sv_2mortal(Perl_newSVpvf(aTHX_
+ "a constant (%"SVf")", sv));
+ useless = SvPV_nolen(msv);
+ }
+ else
+ useless = "a constant (undef)";
if (o->op_private & OPpCONST_ARYBASE)
useless = NULL;
/* don't warn on optimised away booleans, eg
7 ; # OP_CONST
"x" . "y"; # optimized to OP_CONST
2 + 2; # optimized to OP_CONST
-5 || print "bad\n"; # test OPpCONST_SHORTCIRCUIT
use constant U => undef;
+U;
+5 || print "bad\n"; # test OPpCONST_SHORTCIRCUIT
print "boo\n" if U; # test OPpCONST_SHORTCIRCUIT
$[ = 2; # should not warn
no warnings 'void' ;
Useless use of a constant (7) in void context at - line 4.
Useless use of a constant (xy) in void context at - line 5.
Useless use of a constant (4) in void context at - line 6.
+Useless use of a constant (undef) in void context at - line 8.
########
# op.c
#