Skip to content

Commit

Permalink
Croak for \local %{\%foo}
Browse files Browse the repository at this point in the history
See the previous commit.

When I moved the check for local %$ref earlier, I didn’t move it
early enough.
  • Loading branch information
Father Chrysostomos committed Aug 26, 2012
1 parent 858e07c commit 3da9985
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pp_hot.c
Expand Up @@ -777,13 +777,13 @@ PP(pp_rv2av)
if (SvTYPE(sv) != type)
/* diag_listed_as: Not an ARRAY reference */
DIE(aTHX_ "Not %s reference", is_pp_rv2av ? an_array : a_hash);
else if (PL_op->op_flags & OPf_MOD
&& PL_op->op_private & OPpLVAL_INTRO)
Perl_croak(aTHX_ "%s", PL_no_localize_ref);
if (PL_op->op_flags & OPf_REF) {
SETs(sv);
RETURN;
}
else if (PL_op->op_flags & OPf_MOD
&& PL_op->op_private & OPpLVAL_INTRO)
Perl_croak(aTHX_ "%s", PL_no_localize_ref);
else if (PL_op->op_private & OPpMAYBE_LVSUB) {
const I32 flags = is_lvalue_sub();
if (flags && !(flags & OPpENTERSUB_INARGS)) {
Expand Down
10 changes: 10 additions & 0 deletions t/lib/croak/pp_hot
Expand Up @@ -23,6 +23,16 @@ Can't localize through a reference at - line 1.
EXPECT
Can't localize through a reference at - line 1.
########
# NAME \local %$ref
\local %{\%hash}
EXPECT
Can't localize through a reference at - line 1.
########
# NAME \local @$ref
\local @{\@hash}
EXPECT
Can't localize through a reference at - line 1.
########
# NAME calling undef sub belonging to undef GV
my $foosub = \&foo;
undef *foo;
Expand Down

0 comments on commit 3da9985

Please sign in to comment.