diff options
-rw-r--r-- | gv.c | 5 | ||||
-rw-r--r-- | t/op/gv.t | 12 |
2 files changed, 15 insertions, 2 deletions
@@ -1255,7 +1255,10 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, if (addmg) gv = (GV *)newSV(0); else return NULL; } - else gv = *gvp; + else gv = *gvp, addmg = 0; + /* From this point on, addmg means gv has not been inserted in the + symtab yet. */ + if (SvTYPE(gv) == SVt_PVGV) { if (add) { GvMULTI_on(gv); @@ -12,7 +12,7 @@ BEGIN { use warnings; -plan( tests => 236 ); +plan( tests => 238 ); # type coercion on assignment $foo = 'foo'; @@ -906,6 +906,16 @@ eval { *{;undef} = 3 }; like $@, qr/^Can't use an undefined value as a symbol reference at /, '*{ ;undef } assignment'; +# [perl #99142] defined &{"foo"} when there is a constant stub +# If I break your module, you get to have it mentioned in Perl's tests. :-) +package HTTP::MobileAttribute::Plugin::Locator { + use constant LOCATOR_GPS => 1; + ::ok defined &{__PACKAGE__."::LOCATOR_GPS"}, + 'defined &{"name of constant"}'; + ::ok Internals::SvREFCNT(${__PACKAGE__."::"}{LOCATOR_GPS}), + "stash elem for slot is not freed prematurely"; +} + __END__ Perl Rules |