summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGerard Goossen <gerard@ggoossen.net>2009-12-27 17:24:28 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2010-01-10 23:50:36 +0100
commit885ef6f56b61fd750ef3b1fa614d11480baac635 (patch)
tree2e5c91051dfa296a76e61c697e2a57e5669858db /op.c
parent3365b4123660b600293d3f9bd5054523f194b5b9 (diff)
downloadperl-885ef6f56b61fd750ef3b1fa614d11480baac635.tar.gz
Ignore a lvalue attribute after the subroutine has been defined, and warn about it. Fixes part of [perl #68758].
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/op.c b/op.c
index 88a31d33fa..db17d142f1 100644
--- a/op.c
+++ b/op.c
@@ -5714,7 +5714,9 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
)&& !attrs) {
if (CvFLAGS(PL_compcv)) {
/* might have had built-in attrs applied */
- CvFLAGS(cv) |= (CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS);
+ if (CvLVALUE(PL_compcv) && ! CvLVALUE(cv))
+ Perl_warner(aTHX_ packWARN(WARN_MISC), "lvalue attribute ignored after the subroutine has been defined");
+ CvFLAGS(cv) |= (CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS & ~CVf_LVALUE);
}
/* just a "sub foo;" when &foo is already defined */
SAVEFREESV(PL_compcv);