dcb3b7
From b890486ff0c482cbdec59a0f9beb28275aeee19b Mon Sep 17 00:00:00 2001
dcb3b7
From: Tony Cook <tony@develop-help.com>
dcb3b7
Date: Mon, 19 Jun 2017 14:59:53 +1000
dcb3b7
Subject: [PATCH] (perl #131597) ensure the GV slot is filled for our [%$@]foo:
dcb3b7
 attr
dcb3b7
MIME-Version: 1.0
dcb3b7
Content-Type: text/plain; charset=UTF-8
dcb3b7
Content-Transfer-Encoding: 8bit
dcb3b7
dcb3b7
Petr Písař: Ported to 5.24.3.
dcb3b7
dcb3b7
Signed-off-by: Petr Písař <ppisar@redhat.com>
dcb3b7
---
dcb3b7
 op.c         |  6 +++---
dcb3b7
 t/op/attrs.t | 18 ++++++++++++++++++
dcb3b7
 2 files changed, 21 insertions(+), 3 deletions(-)
dcb3b7
dcb3b7
diff --git a/op.c b/op.c
dcb3b7
index 2960dd5..8a5fc3f 100644
dcb3b7
--- a/op.c
dcb3b7
+++ b/op.c
dcb3b7
@@ -3671,9 +3671,9 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
dcb3b7
 	    PL_parser->in_my = FALSE;
dcb3b7
 	    PL_parser->in_my_stash = NULL;
dcb3b7
 	    apply_attrs(GvSTASH(gv),
dcb3b7
-			(type == OP_RV2SV ? GvSV(gv) :
dcb3b7
-			 type == OP_RV2AV ? MUTABLE_SV(GvAV(gv)) :
dcb3b7
-			 type == OP_RV2HV ? MUTABLE_SV(GvHV(gv)) : MUTABLE_SV(gv)),
dcb3b7
+			(type == OP_RV2SV ? GvSVn(gv) :
dcb3b7
+			 type == OP_RV2AV ? MUTABLE_SV(GvAVn(gv)) :
dcb3b7
+			 type == OP_RV2HV ? MUTABLE_SV(GvHVn(gv)) : MUTABLE_SV(gv)),
dcb3b7
 			attrs);
dcb3b7
 	}
dcb3b7
 	o->op_private |= OPpOUR_INTRO;
dcb3b7
diff --git a/t/op/attrs.t b/t/op/attrs.t
dcb3b7
index 219db03..b038c87 100644
dcb3b7
--- a/t/op/attrs.t
dcb3b7
+++ b/t/op/attrs.t
dcb3b7
@@ -447,4 +447,22 @@ package P126257 {
dcb3b7
     ::is $@, "", "RT 126257 sub";
dcb3b7
 }
dcb3b7
 
dcb3b7
+fresh_perl_is('sub dummy {} our $dummy : Dummy', <
dcb3b7
+Invalid SCALAR attribute: Dummy at - line 1.
dcb3b7
+BEGIN failed--compilation aborted at - line 1.
dcb3b7
+EOS
dcb3b7
+              "attribute on our scalar with sub of same name");
dcb3b7
+
dcb3b7
+fresh_perl_is('sub dummy {} our @dummy : Dummy', <
dcb3b7
+Invalid ARRAY attribute: Dummy at - line 1.
dcb3b7
+BEGIN failed--compilation aborted at - line 1.
dcb3b7
+EOS
dcb3b7
+              "attribute on our array with sub of same name");
dcb3b7
+
dcb3b7
+fresh_perl_is('sub dummy {} our %dummy : Dummy', <
dcb3b7
+Invalid HASH attribute: Dummy at - line 1.
dcb3b7
+BEGIN failed--compilation aborted at - line 1.
dcb3b7
+EOS
dcb3b7
+              "attribute on our hash with sub of same name");
dcb3b7
+
dcb3b7
 done_testing();
dcb3b7
-- 
dcb3b7
2.13.6
dcb3b7