summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gv.c6
-rw-r--r--pp.c2
-rw-r--r--sv.c2
-rw-r--r--t/op/coresubs.t6
4 files changed, 11 insertions, 5 deletions
diff --git a/gv.c b/gv.c
index e4c1d211f7..07ff3b2ac1 100644
--- a/gv.c
+++ b/gv.c
@@ -1050,7 +1050,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
const I32 no_init = flags & (GV_NOADD_NOINIT | GV_NOINIT);
const I32 no_expand = flags & GV_NOEXPAND;
const I32 add = flags & ~GV_NOADD_MASK;
- const bool addmg = !!(flags & GV_ADDMG);
+ bool addmg = !!(flags & GV_ADDMG);
const char *const name_end = nambeg + full_len;
const char *const name_em1 = name_end - 1;
U32 faking_it;
@@ -1402,6 +1402,10 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
new ATTRSUB. */
(void)core_prototype((SV *)cv, name, code, &opnum);
if (ampable) {
+ if (addmg) {
+ hv_store(stash,name,len,(SV *)gv,0);
+ addmg = FALSE;
+ }
CvLVALUE_on(cv);
newATTRSUB(oldsavestack_ix,
newSVOP(
diff --git a/pp.c b/pp.c
index ab933c984b..c732c5ba86 100644
--- a/pp.c
+++ b/pp.c
@@ -427,7 +427,7 @@ PP(pp_rv2cv)
GV *gv;
HV *stash_unused;
const I32 flags = (PL_op->op_flags & OPf_SPECIAL)
- ? 0
+ ? GV_ADDMG
: ((PL_op->op_private & (OPpLVAL_INTRO|OPpMAY_RETURN_CONSTANT)) == OPpMAY_RETURN_CONSTANT)
? GV_ADD|GV_NOEXPAND
: GV_ADD;
diff --git a/sv.c b/sv.c
index df0092cad8..2acfafc683 100644
--- a/sv.c
+++ b/sv.c
@@ -8884,7 +8884,7 @@ Perl_sv_2cv(pTHX_ SV *sv, HV **const st, GV **const gvp, const I32 lref)
}
*st = GvESTASH(gv);
fix_gv:
- if (lref && !GvCVu(gv)) {
+ if (lref & ~GV_ADDMG && !GvCVu(gv)) {
SV *tmpsv;
ENTER;
tmpsv = newSV(0);
diff --git a/t/op/coresubs.t b/t/op/coresubs.t
index e64655339b..f0ebe8ed5b 100644
--- a/t/op/coresubs.t
+++ b/t/op/coresubs.t
@@ -31,10 +31,12 @@ while(<$kh>) {
chomp(my $word = $');
if($& eq '+' || $unsupported{$word}) {
$tests ++;
- ok !defined &{\&{"CORE::$word"}}, "no CORE::$word";
+ ok !defined &{"CORE::$word"}, "no CORE::$word";
}
else {
- $tests += 3;
+ $tests += 4;
+
+ ok defined &{"CORE::$word"}, "defined &{'CORE::$word'}";
my $proto = prototype "CORE::$word";
*{"my$word"} = \&{"CORE::$word"};