diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-01-26 13:06:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 06:06:08 +0100 |
commit | d44b0b186943b3187e6dbc8bc5d304f402d978dc (patch) | |
tree | 4d46d5274ddb9a32fbf083dadfaf80be7a820271 /tests/cpp | |
parent | 0b363442e5ffc715347b2d258cd5d98fcd653b5f (diff) | |
download | Nim-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