This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "pos in lvalue context now returns a PVMG instead of a PVLV."
[perl5.git] / pp.c
diff --git a/pp.c b/pp.c
index f87e0dd..385f1be 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -361,8 +361,10 @@ PP(pp_pos)
     dVAR; dSP; dPOPss;
 
     if (PL_op->op_flags & OPf_MOD || LVRET) {
-       SV * const ret = sv_2mortal(newSV_type(SVt_PVMG));  /* Not TARG RT#67838 */
-       sv_magic(ret, sv, PERL_MAGIC_pos, NULL, 0);
+       SV * const ret = sv_2mortal(newSV_type(SVt_PVLV));  /* Not TARG RT#67838 */
+       sv_magic(ret, NULL, PERL_MAGIC_pos, NULL, 0);
+       LvTYPE(ret) = '.';
+       LvTARG(ret) = SvREFCNT_inc_simple(sv);
        PUSHs(ret);    /* no SvSETMAGIC */
        RETURN;
     }