diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-08-28 06:31:48 -0700 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2014-12-27 12:18:56 +0000 |
commit | 806e35e902f3c0f48b542708cb7110b57d15d718 (patch) | |
tree | 025d877de2f6ad8682f7436eb061a49430a9899e /t/op/lexsub.t | |
parent | ea136445d3d39ab4051ce197548b87b46585ed8b (diff) | |
download | perl-806e35e902f3c0f48b542708cb7110b57d15d718.tar.gz |
Fix crash when lex subs are used for AUTOLOAD
(cherry picked from commit 18691622911f2e18df42a5a98ea4c42386f4e558)
Diffstat (limited to 't/op/lexsub.t')
-rw-r--r-- | t/op/lexsub.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/t/op/lexsub.t b/t/op/lexsub.t index d5fdcb1374..54bb985f7d 100644 --- a/t/op/lexsub.t +++ b/t/op/lexsub.t @@ -7,7 +7,7 @@ BEGIN { *bar::is = *is; *bar::like = *like; } -plan 120; +plan 122; # -------------------- Errors with feature disabled -------------------- # @@ -313,6 +313,15 @@ like runperl( ), qr/syntax error/, 'referencing a state sub after a syntax error does not crash'; +{ + state $stuff; + package A { + state sub foo{ $stuff .= our $AUTOLOAD } + *A::AUTOLOAD = \&foo; + } + A::bar(); + is $stuff, 'A::bar', 'state sub assigned to *AUTOLOAD can autoload'; +} # -------------------- my -------------------- # @@ -606,6 +615,15 @@ like runperl( ), qr/syntax error/, 'referencing a my sub after a syntax error does not crash'; +{ + state $stuff; + package A { + my sub foo{ $stuff .= our $AUTOLOAD } + *A::AUTOLOAD = \&foo; + } + A::bar(); + is $stuff, 'A::bar', 'my sub assigned to *AUTOLOAD can autoload'; +} # -------------------- Interactions (and misc tests) -------------------- # |