This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
assert that SvMAGIC is never non-NULL for any PVMG used as a pad name.
[perl5.git] / sv.h
diff --git a/sv.h b/sv.h
index fdb1fd0..5474074 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1011,6 +1011,8 @@ in gv.h: */
 #    define SvMAGIC(sv)                                                        \
        (*({ SV *const _svi = (SV *) sv;                                \
            assert(SvTYPE(_svi) >= SVt_PVMG);                           \
+           if (SvTYPE(_svi) == SVt_PVMG && (SvFLAGS(_svi) & SVpad_NAME)) \
+               assert (!((XPVMG*) SvANY(_svi))->xmg_magic); \
            &(((XPVMG*) SvANY(_svi))->xmg_magic);                       \
          }))
 #    define SvSTASH(sv)                                                        \