summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gv.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/gv.h b/gv.h
index d9a5b51037..f1794943e4 100644
--- a/gv.h
+++ b/gv.h
@@ -24,7 +24,14 @@ struct gp {
#define GvXPVGV(gv) ((XPVGV*)SvANY(gv))
-#define GvGP(gv) (GvXPVGV(gv)->xgv_gp)
+#ifdef DEBUGGING
+# define GvGP(gv) (*(assert(SvTYPE(gv) == SVt_PVGV || \
+ SvTYPE(gv) == SVt_PVLV), \
+ &(GvXPVGV(gv)->xgv_gp)))
+#else
+# define GvGP(gv) (GvXPVGV(gv)->xgv_gp)
+#endif
+
#define GvNAME(gv) (GvXPVGV(gv)->xgv_name)
#define GvNAMELEN(gv) (GvXPVGV(gv)->xgv_namelen)
#define GvSTASH(gv) (GvXPVGV(gv)->xgv_stash)