summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-10-22 05:36:38 -0700
committerRicardo Signes <rjbs@cpan.org>2013-12-19 09:02:45 -0500
commit18ca6dc355e52f6e5cfcb00bf8f5d2e5ff9e40d0 (patch)
tree1cdc6a812d3da9d26d2636e1001f1d761ff10aa6
parent6b5ac6bfd997ed34ce4edcc9b1c98b44a6c166b2 (diff)
downloadperl-18ca6dc355e52f6e5cfcb00bf8f5d2e5ff9e40d0.tar.gz
Unbreak -bareword under strict+integer
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. (cherry picked from commit fcbc518d7ac7875b7f443e72caf15fd07ab023a6)
-rw-r--r--op.c2
-rw-r--r--t/op/negate.t9
2 files changed, 9 insertions, 2 deletions
diff --git a/op.c b/op.c
index ff774503fd..cc370b5209 100644
--- a/op.c
+++ b/op.c
@@ -3206,7 +3206,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)
diff --git a/t/op/negate.t b/t/op/negate.t
index 033beb5c1f..3b02e35f20 100644
--- a/t/op/negate.t
+++ b/t/op/negate.t
@@ -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';
+}