--- /dev/null
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use Variable::Magic qw/wizard cast getdata/;
+
+# Inspired by B::Hooks::EndOfScope
+# This test is better be left at the beginning of the file, since problems
+# happen at UNITCHECK time
+
+my $wiz;
+
+BEGIN {
+ $wiz = wizard data => sub { $_[1] }, free => sub { $_[1]->(); () };
+ $^H |= 0x020000;
+ cast %^H, $wiz, sub { die "harmless" };
+}
+
+pass 'die in free callback in BEGIN didn\'t segfault';