summary refs log tree commit diff stats
path: root/tests/ccgbugs/tmissingvolatile.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ccgbugs/tmissingvolatile.nim')
-rw-r--r--tests/ccgbugs/tmissingvolatile.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ccgbugs/tmissingvolatile.nim b/tests/ccgbugs/tmissingvolatile.nim
new file mode 100644
index 000000000..b877eff71
--- /dev/null
+++ b/tests/ccgbugs/tmissingvolatile.nim
@@ -0,0 +1,21 @@
+discard """
+  output: "1"
+  cmd: r"nim c --hints:on $options --mm:refc -d:release $file"
+  ccodecheck: "'NI volatile state;'"
+  targets: "c"
+"""
+
+# bug #1539
+
+proc err() =
+  raise newException(Exception, "test")
+
+proc main() =
+  var state: int
+  try:
+    state = 1
+    err()
+  except:
+    echo state
+
+main()