diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-06-09 19:02:43 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-06-09 19:02:43 +0000 |
commit | 83bf042f79af6208af0620b081ee65543ecfed9f (patch) | |
tree | d15071a650bd72567ee4a7f5dcd96288f107ef40 /t/op/array.t | |
parent | 0dd3f902b059d48560ea071c6510375fd9426efb (diff) | |
download | perl-83bf042f79af6208af0620b081ee65543ecfed9f.tar.gz |
Fixes the case of $a = \$#{[]}; and then accessing $$a
(but not \$#a after local @a or my @a leave a block)
p4raw-id: //depot/perl@24783
Diffstat (limited to 't/op/array.t')
-rwxr-xr-x | t/op/array.t | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/op/array.t b/t/op/array.t index c003ffe353..16a3df5bca 100755 --- a/t/op/array.t +++ b/t/op/array.t @@ -7,7 +7,7 @@ BEGIN { require 'test.pl'; -plan (85); +plan (88); # # @foo, @bar, and @ary are also used from tie-stdarray after tie-ing them @@ -277,3 +277,13 @@ is ($got, ''); like($@, qr/Modification of non-creatable array value attempted, subscript -1/, "\$a[-1] = 0"); } +{ + local $^W = 1; + my $a = \$#{[]}; + is ($$a, undef, "\$# on freed array is undef"); + my @warn; + local $SIG{__WARN__} = sub {push @warn, "@_"}; + $$a = 1000; + is (scalar @warn, 1); + like ($warn[0], qr/^Attempt to set length of freed array/); +} |