summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-12-14 04:23:58 +0000
committerZefram <zefram@fysh.org>2017-12-14 04:23:58 +0000
commit3d033384b2016a58c3eed89524dc658660c759ce (patch)
treed24894c25e1d1f5a61afd1e146b6bf43a9ff331a /op.c
parent9b568b537ddf7c0495ef59f31183cfb270c398bc (diff)
downloadperl-3d033384b2016a58c3eed89524dc658660c759ce.tar.gz
warn on $a.$b.$c in void context
$a.$b.$c gets transformed early on to execute as ($a.$b).=$c, which didn't warn about void context becuase .= looks like a useful side effect. Happily, the recently-added OPpCONCAT_NESTED flag identifies that this has happened. Make scalarvoid() pay attention to this flag when a concat op is put into void context. Fixes [perl #6997]
Diffstat (limited to 'op.c')
-rw-r--r--op.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/op.c b/op.c
index 74de752405..402c6f1610 100644
--- a/op.c
+++ b/op.c
@@ -1949,6 +1949,11 @@ Perl_scalarvoid(pTHX_ OP *arg)
if (o->op_type == OP_REPEAT)
scalar(cBINOPo->op_first);
goto func_ops;
+ case OP_CONCAT:
+ if ((o->op_flags & OPf_STACKED) &&
+ !(o->op_private & OPpCONCAT_NESTED))
+ break;
+ goto func_ops;
case OP_SUBSTR:
if (o->op_private == 4)
break;