summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-11-30 05:54:23 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-11-30 08:43:28 -0800
commit6b7c6d9593471bad3cd6ea2eb3e51ebf08acad3a (patch)
tree5e1f08931d926c67334b73e06a730d049533a0ed /op.c
parentd9a4b459f94297889956ac3adc42707365f274c2 (diff)
downloadperl-6b7c6d9593471bad3cd6ea2eb3e51ebf08acad3a.tar.gz
[perl #77762] Constant assignment warning
With this patch: $ ./perl -we 'sub A () {1}; if (0) {my $foo = A or die}' $ ./perl -we 'sub A () {1}; if (0) {my $foo = 1 or die}' Found = in conditional, should be == at -e line 1. Since the value of a constant may not be known at the time the program is written, it should be perfectly acceptable to do a constant assign- ment in a conditional.
Diffstat (limited to 'op.c')
-rw-r--r--op.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/op.c b/op.c
index 20083ad4c4..469a008c8e 100644
--- a/op.c
+++ b/op.c
@@ -910,7 +910,8 @@ S_scalarboolean(pTHX_ OP *o)
PERL_ARGS_ASSERT_SCALARBOOLEAN;
- if (o->op_type == OP_SASSIGN && cBINOPo->op_first->op_type == OP_CONST) {
+ if (o->op_type == OP_SASSIGN && cBINOPo->op_first->op_type == OP_CONST
+ && !(cBINOPo->op_first->op_flags & OPf_SPECIAL)) {
if (ckWARN(WARN_SYNTAX)) {
const line_t oldline = CopLINE(PL_curcop);