Closed tonycoz closed 3 weeks ago
Perl crashes with an assertion (debugging builds) or an unhelpful message (non-debugging) if you attempt to create an object of an incomplete class.
Is this the "unhelpful message" you get in non-debugging builds?
$ ./bin/perl -Ilib -Mfeature=class -e 'eval "class Foo {"; Foo->new'
class is experimental at (eval 1) line 1.
Not a CODE reference at -e line 1.
(From a non-debugging build of perl-5.39.5 on Linux; similar output at today's HEAD on blead.)
The "unhelpful" error message on regular build, as well as the crash on debugging build, appear to have first appeared at commit 080297a1c0 back in September.
$ git show --format=fuller 080297a1c0
commit 080297a1c054c421f95cf78ca4f58a960f1d124f
Author: Tony Cook <tony@develop-help.com>
AuthorDate: Tue Sep 5 16:37:48 2023 +1000
Commit: Tony Cook <tony@develop-help.com>
CommitDate: Fri Sep 15 09:10:37 2023 +1000
class: don't leak the default initialiser ops if they're forbidden
...
$ uname -mrs; gcc --version | head -n 1
Linux 6.5.0-27-generic x86_64
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
$ sh ./Configure -des -Dusedevel -Dcc=gcc && make
$ git describe
v5.39.2-120-g37f50f0f03
$ ./perl -Ilib -Mfeature=class -e 'eval "class Foo {"; Foo->new'
class is experimental at (eval 1) line 1.
Undefined subroutine called at -e line 1.
$ git describe; ./perl -Ilib -Mfeature=class -e 'eval "class Foo {"; Foo->new'
v5.39.2-121-g080297a1c0
class is experimental at (eval 1) line 1.
Not a CODE reference at -e line 1.
$ sh ./Configure -des -Dusedevel -Dcc=gcc -DDEBUGGING && make
$ git describe; ./perl -Ilib -Mfeature=class -e 'eval "class Foo {"; Foo->new'
v5.39.2-120-g37f50f0f03
class is experimental at (eval 1) line 1.
Undefined subroutine called at -e line 1.
$ git describe; ./perl -Ilib -Mfeature=class -e 'eval "class Foo {"; Foo->new'
v5.39.2-121-g080297a1c0
class is experimental at (eval 1) line 1.
perl: class.c:170: injected_constructor: Assertion `aux->xhv_class_initfields_cv' failed.
Aborted (core dumped)
I think this qualifies as a Release Blocker; so labeling.
Module:
Description
Perl crashes with an assertion (debugging builds) or an unhelpful message (non-debugging) if you attempt to create an object of an incomplete class.
Steps to Reproduce
Expected behavior
A helpful error message.
Perl configuration