Thanks to misuse of CvGV.
$ perl5.19.5 -XMfeature=:all -e 'my sub foo {} undef &foo; *UNIVERSAL::bar = \&foo; main->bar()'
Segmentation fault: 11
When deciding under which name to autoload the sub, we can’t assume
CvGV(that_sub) is a GV, as it may be null.
GV* stubgv;
GV* autogv;
- if (CvANON(cv))
+ if (CvANON(cv) || !CvGV(cv))
stubgv = gv;
else {
stubgv = CvGV(cv);
*bar::like = *like;
}
no warnings 'deprecated';
-plan 138;
+plan 139;
# -------------------- Errors with feature disabled -------------------- #
),
qr/Constant subroutine foo undefined at /,
'constant undefinition warnings for lexical subs do not crash';
+
+{
+ my sub foo;
+ *AutoloadTestSuper::blah = \&foo;
+ sub AutoloadTestSuper::AUTOLOAD {
+ is $AutoloadTestSuper::AUTOLOAD, "AutoloadTestSuper::blah",
+ "Autoloading via inherited lex stub";
+ }
+ @AutoloadTest::ISA = AutoloadTestSuper::;
+ AutoloadTest->blah;
+}