diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-07-19 02:53:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-18 20:53:07 +0200 |
commit | 3a103669d18408cd75ca5c5c97c34f4222c6e217 (patch) | |
tree | e539caadbb207be8f4bc6d14c38fb63d2bd990eb /tests | |
parent | 6aa54d533b3ee10ed5156b0f67f5418bc4b6d99d (diff) | |
download | Nim-3a103669d18408cd75ca5c5c97c34f4222c6e217.tar.gz |
fixes #23858; 2.2.0 rc1 regression with cdecl functions (#23859)
fixes #23858 We should not assign fields to fields for returns of function calls because calls might have side effects.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arc/tarc_orc.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/arc/tarc_orc.nim b/tests/arc/tarc_orc.nim index 674ba0dbb..0e6208b4a 100644 --- a/tests/arc/tarc_orc.nim +++ b/tests/arc/tarc_orc.nim @@ -160,3 +160,14 @@ block: testCase() main() + +block: # bug #23858 + type Object = object + a: int + b: ref int + var x = 0 + proc fn(): auto {.cdecl.} = + inc x + return Object() + discard fn() + doAssert x == 1 |