summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-03 22:56:37 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-04 23:54:33 -0800
commit7c2b3c783b7cfdd1c2c7d51e431850e6b2be74ae (patch)
tree74ced0bebb52d150d36cb23cd047206599ec0a1a /op.c
parent5ea6993dc3abe359587df7b497c38e981f4695cd (diff)
downloadperl-7c2b3c783b7cfdd1c2c7d51e431850e6b2be74ae.tar.gz
Restrict $[ comp warning to constants
$#a > $[ is a legitimate use of $[ with >. So warning in that case is not nice. Most version comparisons are done with constants, like 5.006, so warn only for constants.
Diffstat (limited to 'op.c')
-rw-r--r--op.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/op.c b/op.c
index 59e2b2949e..709ef91d3f 100644
--- a/op.c
+++ b/op.c
@@ -7320,8 +7320,12 @@ Perl_ck_cmp(pTHX_ OP *o)
if (ckWARN(WARN_SYNTAX)) {
const OP *kid = cUNOPo->op_first;
if (kid && (
- is_dollar_bracket(aTHX_ kid)
- || ((kid = kid->op_sibling) && is_dollar_bracket(aTHX_ kid))
+ (
+ is_dollar_bracket(aTHX_ kid)
+ && kid->op_sibling && kid->op_sibling->op_type == OP_CONST
+ )
+ || ( kid->op_type == OP_CONST
+ && (kid = kid->op_sibling) && is_dollar_bracket(aTHX_ kid))
))
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
"$[ used in %s (did you mean $] ?)", OP_DESC(o));