Subject: [perl #51092] [PATCH] Segfault when calling ->next::method on non-existing package
From: ilmari@vesla.ilmari.org (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-15287-
1203654581-377.51092-75-0@perl.org>
p4raw-id: //depot/perl@33367
if(sv_isobject(self))
selfstash = SvSTASH(SvRV(self));
else
- selfstash = gv_stashsv(self, 0);
+ selfstash = gv_stashsv(self, GV_ADD);
assert(selfstash);
use strict;
use warnings;
-require q(./test.pl); plan(tests => 11);
+require q(./test.pl); plan(tests => 12);
{
eval { $baz->bar() };
ok($@, '... calling bar() with next::method failed') || diag $@;
- }
+ }
+
+ # Test with non-existing class (used to segfault)
+ {
+ package Qux;
+ use mro;
+ sub foo { No::Such::Class->next::can }
+ }
+
+ eval { Qux->foo() };
+ is($@, '', "->next::can on non-existing package name");
+
}