no_bareword_allowed(o);
else {
if (ckWARN(WARN_VOID)) {
- useless = "a constant";
+ SV* msv = newSVpvf("a constant (%"SVf")", sv);
+ useless = SvPV_nolen(msv);
if (o->op_private & OPpCONST_ARYBASE)
useless = NULL;
/* don't warn on optimised away booleans, eg
use warnings 'void' ;
"abc"; # OP_CONST
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;
print "boo\n" if U; # test OPpCONST_SHORTCIRCUIT
no warnings 'void' ;
"abc"; # OP_CONST
7 ; # OP_CONST
+"x" . "y"; # optimized to OP_CONST
+2 + 2; # optimized to OP_CONST
EXPECT
-Useless use of a constant in void context at - line 3.
-Useless use of a constant in void context at - line 4.
+Useless use of a constant (abc) in void context at - line 3.
+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.
########
# op.c
#