From: Ben Morrow <ben@morrow.me.uk>
Date: Mon, 15 Oct 2007 22:56:16 +0000 (+0100)
Subject: ex-PVBM and mro interact badly
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a5a709ec819bfe84b1af6f781d5d87ef68e00c3a;p=p5sagit%2Fp5-mst-13.2.git

ex-PVBM and mro interact badly
Message-ID: <20071015215616.GA43800@osiris.mauzo.dyndns.org>

p4raw-id: //depot/perl@32119
---

diff --git a/hv.c b/hv.c
index 95df7c8..c8279d8 100644
--- a/hv.c
+++ b/hv.c
@@ -1450,7 +1450,7 @@ Perl_hv_free_ent(pTHX_ HV *hv, register HE *entry)
     if (!entry)
 	return;
     val = HeVAL(entry);
-    if (val && isGV(val) && GvCVu(val) && HvNAME_get(hv))
+    if (val && isGV(val) && isGV_with_GP(val) && GvCVu(val) && HvNAME_get(hv))
         mro_method_changed_in(hv);	/* deletion of method from stash */
     SvREFCNT_dec(val);
     if (HeKLEN(entry) == HEf_SVKEY) {
diff --git a/t/op/hash.t b/t/op/hash.t
index 6e1b4da..9bde518 100644
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -8,7 +8,7 @@ BEGIN {
 
 use strict;
 
-plan tests => 5;
+plan tests => 6;
 
 my %h;
 
@@ -109,3 +109,12 @@ sub hash {
     $u += $u << 15; $u %= MASK_U32;
     $u;
 }
+
+# This will crash perl if it fails
+
+use constant PVBM => 'foo';
+
+my $dummy = index 'foo', PVBM;
+eval { my %h = (a => PVBM); 1 };
+
+ok (!$@, 'fbm scalar can be inserted into a hash');