diff options
author | Araq <rumpf_a@web.de> | 2019-05-24 00:12:36 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-05-24 00:12:36 +0200 |
commit | b75ad05267bad6f10e1939354eac14ac821fb8c6 (patch) | |
tree | e001b946cffd86c12a808e1233411704aa263059 /tests/destructor | |
parent | 981f95757c4b312a4f3e4bc6d6d92b3734331e98 (diff) | |
download | Nim-b75ad05267bad6f10e1939354eac14ac821fb8c6.tar.gz |
fixes move analyser; refs #11257
Diffstat (limited to 'tests/destructor')
-rw-r--r-- | tests/destructor/tconsume_twice.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/destructor/tconsume_twice.nim b/tests/destructor/tconsume_twice.nim new file mode 100644 index 000000000..a06ea4efd --- /dev/null +++ b/tests/destructor/tconsume_twice.nim @@ -0,0 +1,12 @@ +discard """ + cmd: "nim c --newruntime $file" + errormsg: "sink parameter `a` is already consumed at tconsume_twice.nim(8, 6)" + line: 10 +""" + +proc consumeTwice(a: owned proc()): owned proc() = + if a == nil: + return + return a + +assert consumeTwice(proc() = discard) != nil |