summary refs log tree commit diff stats
path: root/tests/cpp
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-01-26 13:06:08 +0800
committerGitHub <noreply@github.com>2024-01-26 06:06:08 +0100
commitd44b0b186943b3187e6dbc8bc5d304f402d978dc (patch)
tree4d46d5274ddb9a32fbf083dadfaf80be7a820271 /tests/cpp
parent0b363442e5ffc715347b2d258cd5d98fcd653b5f (diff)
downloadNim-d44b0b186943b3187e6dbc8bc5d304f402d978dc.tar.gz
fixes #22597; avoid side effects for call returning openArray types (#23257)
fixes #22597

```nim
proc autoToOpenArray*[T](s: Slice[T]): openArray[T] =
  echo "here twice"
  result = toOpenArray(s.p, s.first, s.last)
```
For functions returning openarray types, `fixupCall` creates a temporary
variable to store the return value: `let tmp = autoToOpenArray()`. But
`genOpenArrayConv` cannot handle openarray assignements with side
effects. It should have stored the right part of the assignment first
instead of calling the right part twice.
Diffstat (limited to 'tests/cpp')
0 files changed, 0 insertions, 0 deletions