Skip to content

Commit 7aa27d7

Browse files
committed
perldelta for the 2-var 'for' crash (#23405)
1 parent 55ce815 commit 7aa27d7

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

pod/perldelta.pod

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,29 @@ manager will later use a regex to expand these into links.
367367

368368
=item *
369369

370-
XXX
370+
Certain constructs involving a two-variable C<for> loop would crash the perl
371+
compiler in v5.42.0:
372+
373+
# Two-variable for loop over a list returned from a method call:
374+
for my ($x, $y) (Some::Class->foo()) { ... }
375+
for my ($x, $y) ($object->foo()) { ... }
376+
377+
and
378+
379+
# Two-variable for loop over a list returned from a call to a
380+
# lexical(ly imported) subroutine, all inside a lexically scoped
381+
# or anonymous subroutine:
382+
my sub foo { ... }
383+
my $fn = sub {
384+
for my ($x, $y) (foo()) { ... }
385+
};
386+
387+
use builtin qw(indexed); # lexical import!
388+
my sub bar {
389+
for my ($x, $y) (indexed(...)) { ... }
390+
}
391+
392+
These have been fixed. [GH #23405]
371393

372394
=back
373395

0 commit comments

Comments
 (0)