diff options
Diffstat (limited to 'tests/effects/tfuncs_cannot_mutate_simple.nim')
-rw-r--r-- | tests/effects/tfuncs_cannot_mutate_simple.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/effects/tfuncs_cannot_mutate_simple.nim b/tests/effects/tfuncs_cannot_mutate_simple.nim new file mode 100644 index 000000000..0ae4a0db9 --- /dev/null +++ b/tests/effects/tfuncs_cannot_mutate_simple.nim @@ -0,0 +1,19 @@ +discard """ + errormsg: '''cannot mutate location x.data within a strict func''' + line: 15 +""" + +{.experimental: "strictFuncs".} + +# bug #15508 + +type + MyType = ref object + data: string + +func edit(x: MyType) = + x.data = "hello" + +let x = MyType() +x.edit() +echo x.data |