diff --git a/pp.c b/pp.c index b24cd428496b..5ecf7a27ebf2 100644 --- a/pp.c +++ b/pp.c @@ -62,12 +62,13 @@ PP(pp_introcv) PP(pp_clonecv) { - dTARGET; + CV * const protocv = PadnamePROTOCV( PadlistNAMESARRAY(CvPADLIST(find_runcv(NULL)))[ARGTARG] ); - assert(SvTYPE(TARG) == SVt_PVCV); assert(protocv); + dTARGET; + assert(SvTYPE(TARG) == SVt_PVCV); if (CvISXSUB(protocv)) { /* constant */ /* XXX Should we clone it here? */ /* If this changes to use SAVECLEARSV, we can move the SAVECLEARSV diff --git a/universal.c b/universal.c index bd9d6397352b..dec8cd5ac908 100644 --- a/universal.c +++ b/universal.c @@ -1436,8 +1436,10 @@ Perl_boot_core_UNIVERSAL(pTHX) /* Providing a Regexp::DESTROY fixes #21347. See test in t/op/ref.t */ { - CV * const cv = - newCONSTSUB(get_hv("Regexp::", GV_ADD), "DESTROY", NULL); + GV* const gv = gv_fetchpvs("Regexp::", GV_ADD, SVt_PVHV); + HV* const stash = GvHV(gv); + CV* const cv = + newCONSTSUB_flags(stash, "DESTROY", STRLENs("DESTROY"), 0, NULL); char ** cvfile = &CvFILE(cv); char * oldfile = *cvfile; CvDYNFILE_off(cv);