Skip to content

Commit 8eda65e

Browse files
committed
perldelta for the 2-var 'for' crash (#23405)
1 parent f5932f8 commit 8eda65e

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
@@ -374,7 +374,29 @@ manager will later use a regex to expand these into links.
374374

375375
=item *
376376

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

379401
=item *
380402

0 commit comments

Comments
 (0)