summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp.c8
-rw-r--r--t/op/gv.t17
2 files changed, 20 insertions, 5 deletions
diff --git a/pp.c b/pp.c
index 297b532058..9a74280f69 100644
--- a/pp.c
+++ b/pp.c
@@ -218,15 +218,15 @@ PP(pp_rv2gv)
if (sv) SvFAKE_off(sv);
}
}
- if (PL_op->op_private & OPpLVAL_INTRO)
- save_gp(MUTABLE_GV(sv), !(PL_op->op_flags & OPf_SPECIAL));
if (sv && SvFAKE(sv)) {
SV *newsv = sv_newmortal();
sv_setsv_flags(newsv, sv, 0);
SvFAKE_off(newsv);
- SETs(newsv);
+ sv = newsv;
}
- else SETs(sv);
+ if (PL_op->op_private & OPpLVAL_INTRO)
+ save_gp(MUTABLE_GV(sv), !(PL_op->op_flags & OPf_SPECIAL));
+ SETs(sv);
RETURN;
}
diff --git a/t/op/gv.t b/t/op/gv.t
index f04bda0575..862a0cf451 100644
--- a/t/op/gv.t
+++ b/t/op/gv.t
@@ -12,7 +12,7 @@ BEGIN {
use warnings;
-plan( tests => 230 );
+plan( tests => 231 );
# type coersion on assignment
$foo = 'foo';
@@ -857,6 +857,21 @@ ok eval {
*$glob = *foo;
}, "Assigning a glob to a glob-with-sub that has lost its stash warks";
+{
+ package Tie::Alias;
+ sub TIESCALAR{ bless \\pop }
+ sub FETCH { $${$_[0]} }
+ sub STORE { $${$_[0]} = $_[1] }
+ package main;
+ tie my $alias, 'Tie::Alias', my $var;
+ no warnings 'once';
+ $var = *galobbe;
+ {
+ local *$alias = [];
+ $var = 3;
+ is $alias, 3, "[perl #77926] Glob reification during localisation";
+ }
+}
__END__
Perl