diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-11-19 23:39:57 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-11-20 14:14:00 -0800 |
commit | e38acfd7c47f53eee8797f81f9039529d0bbfac1 (patch) | |
tree | 571dd71f4e51b4210a49ad35b0e72d9508e352f0 /t | |
parent | 8e1fa37c0a5504fad7b88bfd3aa0e59d003ff422 (diff) | |
download | perl-e38acfd7c47f53eee8797f81f9039529d0bbfac1.tar.gz |
Make constant promotion null-clean
When an optimised constant is promoted to a CV, the name’s length can
be passed straight to newCONSTSUB_flags, as it now has a length param-
eter which it passes to newXS_len_flags.
Diffstat (limited to 't')
-rw-r--r-- | t/op/gv.t | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -12,7 +12,7 @@ BEGIN { use warnings; -plan( tests => 238 ); +plan( tests => 239 ); # type coercion on assignment $foo = 'foo'; @@ -918,6 +918,18 @@ package HTTP::MobileAttribute::Plugin::Locator { "stash elem for slot is not freed prematurely"; } +# Check that constants promoted to CVs point to the right GVs when the name +# contains a null. +package lrcg { + use constant x => 3; + # These two lines abuse the optimisation that copies the scalar ref from + # one stash element to another, to get a constant with a null in its name + *{"yz\0a"} = \&{"x"}; + my $ref = \&{"yz\0a"}; + ::ok !exists $lrcg::{yz}, + 'constants w/nulls in their names point 2 the right GVs when promoted'; +} + __END__ Perl Rules |