Skip to content

Commit d143571

Browse files
committed
perldelta for non-ampable CORE::__CLASS__
1 parent 63b91e0 commit d143571

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pod/perldelta.pod

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,27 @@ manager will later use a regex to expand these into links.
434434

435435
XXX
436436

437+
=item * C<&CORE::__CLASS__> no longer returns invalid results
438+
439+
C<CORE::__CLASS__> would work as expected when used as a bareword or aliased:
440+
441+
use feature qw(class);
442+
class Foo {
443+
BEGIN { *cls = \&CORE::__CLASS__; }
444+
method bar() {
445+
my $class1 = CORE::__CLASS__; # ok
446+
my $class2 = cls; # ok
447+
}
448+
}
449+
450+
But when called with an ampersand (C<&CORE::__CLASS__()>) or through a
451+
reference (C<< my $ref = \&CORE::__CLASS__; $ref->() >>), it would return
452+
unrelated strings. These runtime calls have been fixed to throw an error of the
453+
form C<&CORE::__CLASS__ cannot be called directly> instead of silently
454+
returning incorrect results.
455+
456+
[GH #23737]
457+
437458
=item * C<parse_subsignature()> can now handle empty subroutine signatures
438459

439460
Previously, calling the C<parse_subsignature()> API function with an empty

0 commit comments

Comments
 (0)