about summary refs log tree commit diff
path: root/Test/C01arith.ztst
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2017-09-05 13:15:30 +0100
committerPeter Stephenson <pws@zsh.org>2017-09-05 13:15:30 +0100
commitea5b38935a17af38a328c8013e7eaf3c8de7ba09 (patch)
treec91701390f945d17ba5c69ad04198d577c88aaeb /Test/C01arith.ztst
parent5a8155f7b7ab8f3cab1f95d4dba5ed49de0ab77c (diff)
downloadzsh-ea5b38935a17af38a328c8013e7eaf3c8de7ba09.tar.gz
zsh-ea5b38935a17af38a328c8013e7eaf3c8de7ba09.tar.xz
zsh-ea5b38935a17af38a328c8013e7eaf3c8de7ba09.zip
41641: Some math operations shouldn't be lvalues.
This includes pre- and post- increment and decrement.  Simply
mark all values after operations as rvalues.
Diffstat (limited to 'Test/C01arith.ztst')
-rw-r--r--Test/C01arith.ztst13
1 files changed, 13 insertions, 0 deletions
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 61da763ac..30409adf3 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -420,3 +420,16 @@
 0:type of variable when created in arithmetic context
 >integer
 >scalar
+
+  integer a=1
+  print $(( ++a * 2 ))
+  print $(( ++a ))
+  print $(( a++ * 2 ))
+  print $(( a ))
+  print $(( ++a++ * 2 ))
+1: Allow rvalue but not lvalue operations with result of increment
+>4
+>3
+>6
+>4
+?(eval):6: bad math expression: lvalue required