Unbreak -bareword under strict+integer
authorFather Chrysostomos <sprout@cpan.org>
Tue, 22 Oct 2013 12:36:38 +0000 (05:36 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 22 Oct 2013 12:37:22 +0000 (05:37 -0700)
Commit 077da62ff9 was not supposed to change behaviour, but only
remove logic rendered unnecessary two commits earlier in 1c2b3fd6f10.

But the special stricture exception for negation was in the same func-
tion (S_op_integerize) which applied it to OP_NEGATE, but now needed
to apply it to OP_I_NEGATE, too.

op.c
t/op/negate.t

diff --git a/op.c b/op.c
index c4db56f..c37f47b 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3368,7 +3368,7 @@ S_op_integerize(pTHX_ OP *o)
     if ((PL_opargs[type] & OA_OTHERINT) && (PL_hints & HINT_INTEGER))
     {
        dVAR;
-       o->op_ppaddr = PL_ppaddr[type = ++(o->op_type)];
+       o->op_ppaddr = PL_ppaddr[++(o->op_type)];
     }
 
     if (type == OP_NEGATE)
index 033beb5..3b02e35 100644 (file)
@@ -6,7 +6,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan tests => 45;
+plan tests => 46;
 
 # Some of these will cause warnings if left on.  Here we're checking the
 # functionality, not the warnings.
@@ -102,3 +102,10 @@ is -$t, -97656250000000000, 'magic str+int dualvar';
     is(-$au, -$a, 'utf8 flag makes no difference for string negation');
     is -"\x{100}", 0, '-(non-ASCII) is equivalent to -(punct)';
 }
+
+# [perl #120288] use integer should not stop barewords from being quoted
+{
+    use strict;
+    use integer;
+    is eval "return -a"||$@, "-a", '-bareword under strict+integer';
+}