This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #77762] Constant assignment warning
authorFather Chrysostomos <sprout@cpan.org>
Tue, 30 Nov 2010 13:54:23 +0000 (05:54 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 30 Nov 2010 16:43:28 +0000 (08:43 -0800)
commit6b7c6d9593471bad3cd6ea2eb3e51ebf08acad3a
tree5e1f08931d926c67334b73e06a730d049533a0ed
parentd9a4b459f94297889956ac3adc42707365f274c2
[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.
ext/B/t/optree_constants.t
ext/B/t/optree_samples.t
op.c
op.h
t/lib/warnings/op
toke.c