summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--t/op/universal.t4
-rw-r--r--universal.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/t/op/universal.t b/t/op/universal.t
index 01459dd795..bbee79ecf6 100644
--- a/t/op/universal.t
+++ b/t/op/universal.t
@@ -10,7 +10,7 @@ BEGIN {
require "./test.pl";
}
-plan tests => 138;
+plan tests => 139;
$a = {};
bless $a, "Bob";
@@ -336,3 +336,5 @@ ok(Undeclared->can("can"));
sub Undeclared::foo { }
ok(Undeclared->can("foo"));
ok(!Undeclared->can("something_else"));
+
+ok(Undeclared->isa("UNIVERSAL"));
diff --git a/universal.c b/universal.c
index 383feaae00..a7c480f52c 100644
--- a/universal.c
+++ b/universal.c
@@ -164,6 +164,8 @@ Perl_sv_derived_from_pvn(pTHX_ SV *sv, const char *const name, const STRLEN len,
}
else {
stash = gv_stashsv(sv, 0);
+ if (!stash)
+ stash = gv_stashpv("UNIVERSAL", 0);
}
return stash ? isa_lookup(stash, name, len, flags) : FALSE;