From: Nicholas Clark Date: Sun, 27 Apr 2008 10:20:10 +0000 (+0000) Subject: Warnings within the conditional of until() and for() are not reported X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d12f7a6a491a8bf98b22bd9b6e1a5ee0d9f48c4b;p=p5sagit%2Fp5-mst-13.2.git Warnings within the conditional of until() and for() are not reported with the correct line number. (See change 33756). Curiously, warnings for the third expression of for() have the correct line number. p4raw-id: //depot/perl@33758 --- diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index b1c2a4f..09bd371 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -1348,6 +1348,49 @@ EXPECT Use of uninitialized value $c in numeric eq (==) at - line 5. Use of uninitialized value $c in numeric eq (==) at - line 5. ######## +# TODO long standing bug - conditions of until loops +use warnings; + +my $c; +my $d; +until ($c == 1) { + # a + # few + # blank + # lines + $c = 1 if ++$d == 2; +} +EXPECT +Use of uninitialized value $c in numeric eq (==) at - line 5. +Use of uninitialized value $c in numeric eq (==) at - line 5. +######## +# TODO long standing bug - conditions of for loops +use warnings; + +my $c; +my $d; +for ($d = 1; $c == 0 && $d; ) { + # a + # few + # blank + # lines + undef $d; +} + +my $e; +for ($d = 2; $d > 0; $e = !($c == 0)) { + # a + # few + # blank + # lines + --$d; +} +EXPECT +Use of uninitialized value $c in numeric eq (==) at - line 5. +Use of uninitialized value $c in numeric eq (==) at - line 5. +Use of uninitialized value $c in numeric eq (==) at - line 14. +Use of uninitialized value $c in numeric eq (==) at - line 14. +######## # TODO long standing bug - more general variant of the above problem use warnings; my $undef;