In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/4f187fc91707286d3f695e2ea5e34351c2516fc6?hp=1710b4c094bcb01846632947bc64dce5d1c62def>
- Log ----------------------------------------------------------------- commit 4f187fc91707286d3f695e2ea5e34351c2516fc6 Author: Vincent Pit <[email protected]> Date: Tue May 26 16:56:39 2009 +0200 Explicitely point to $. when it causes an uninitialized warning for ranges in scalar context ----------------------------------------------------------------------- Summary of changes: sv.c | 8 ++++++++ t/lib/warnings/9uninit | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 0 deletions(-) diff --git a/sv.c b/sv.c index 1dad3cf..9944724 100644 --- a/sv.c +++ b/sv.c @@ -12984,6 +12984,14 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, Need a better fix at dome point. DAPM 11/2007 */ break; + case OP_FLIP: + case OP_FLOP: + { + GV * const gv = gv_fetchpvs(".", GV_NOTQUAL, SVt_PV); + if (gv && GvSV(gv) == uninit_sv) + return newSVpvs_flags("$.", SVs_TEMP); + goto do_op; + } case OP_POS: /* def-ness of rval pos() is independent of the def-ness of its arg */ diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index 50db322..50e7f50 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -446,6 +446,29 @@ Use of uninitialized value $m1 in exists at - line 7. Use of uninitialized value $g1 in exists at - line 8. ######## use warnings 'uninitialized'; +my ($m1, $m2); +my ($v, @a); + +local $.; + +...@ma = (1 .. 2); +...@ma = ($m1 .. 2); +...@ma = (1 .. $m2); +...@ma = ($m1 .. $m2); + +$v = (1 .. 2); +$v = ($m1 .. 2); +$v = (1 .. $m2); +$v = ($m1 .. $m2); +EXPECT +Use of uninitialized value $m1 in range (or flop) at - line 8. +Use of uninitialized value $m2 in range (or flop) at - line 9. +Use of uninitialized value in range (or flop) at - line 10. +Use of uninitialized value in range (or flop) at - line 10. +Use of uninitialized value $. in range (or flip) at - line 12. +Use of uninitialized value $. in range (or flip) at - line 14. +######## +use warnings 'uninitialized'; my ($m1, $v); our ($g1); -- Perl5 Master Repository
