diff options
-rw-r--r-- | op.c | 5 | ||||
-rw-r--r-- | pad.c | 2 | ||||
-rw-r--r-- | t/op/lexsub.t | 16 |
3 files changed, 19 insertions, 4 deletions
@@ -7935,7 +7935,8 @@ Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) CvNAME_HEK_set(*spot, hek = share_hek( PadnamePV(name)+1, - PadnameLEN(name)-1 * (PadnameUTF8(name) ? -1 : 1), hash + (PadnameLEN(name)-1) * (PadnameUTF8(name) ? -1 : 1), + hash ) ); CvLEXICAL_on(*spot); @@ -8092,7 +8093,7 @@ Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) U32 hash; PERL_HASH(hash, PadnamePV(name)+1, PadnameLEN(name)-1); hek = share_hek(PadnamePV(name)+1, - PadnameLEN(name)-1 * (PadnameUTF8(name) ? -1 : 1), + (PadnameLEN(name)-1) * (PadnameUTF8(name) ? -1 : 1), hash); } CvNAME_HEK_set(cv, hek); @@ -2128,7 +2128,7 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, bool newcv) CvNAME_HEK_set( sv, share_hek(SvPVX_const(namesv)+1, - SvCUR(namesv) - 1 + (SvCUR(namesv) - 1) * (SvUTF8(namesv) ? -1 : 1), hash) ); diff --git a/t/op/lexsub.t b/t/op/lexsub.t index e170555517..32f8bc7eac 100644 --- a/t/op/lexsub.t +++ b/t/op/lexsub.t @@ -7,7 +7,7 @@ BEGIN { *bar::is = *is; *bar::like = *like; } -plan 144; +plan 146; # -------------------- Errors with feature disabled -------------------- # @@ -424,6 +424,13 @@ is runperl(switches => ['-lXMfeature=:all'], " - no 'No comma allowed' after state sub\n"; curr_test(curr_test()+1); } +{ + use utf8; + state sub φου; + eval { φου }; + like $@, qr/^Undefined subroutine &φου called at /, + 'state sub with utf8 name'; +} # -------------------- my -------------------- # @@ -793,6 +800,13 @@ is runperl(switches => ['-lXMfeature=:all'], my sub y :prototype() {$x}; is y, 43, 'my sub that looks like constant closure'; } +{ + use utf8; + my sub φου; + eval { φου }; + like $@, qr/^Undefined subroutine &φου called at /, + 'my sub with utf8 name'; +} # -------------------- Interactions (and misc tests) -------------------- # |