diff options
author | Zefram <zefram@fysh.org> | 2017-12-14 04:23:58 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-14 04:23:58 +0000 |
commit | 3d033384b2016a58c3eed89524dc658660c759ce (patch) | |
tree | d24894c25e1d1f5a61afd1e146b6bf43a9ff331a /op.c | |
parent | 9b568b537ddf7c0495ef59f31183cfb270c398bc (diff) | |
download | perl-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.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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; |