summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-04-04 18:18:43 +0800
committerGitHub <noreply@github.com>2023-04-04 12:18:43 +0200
commit3575f2bf9ccdabe5fa1fcade086ef0c11adc67b5 (patch)
tree73dbaf257e512682d530785a6ef77dba2dfdc2f4 /tests
parent31d3606fe82855dc63cb59fa509577ba1c3a3b86 (diff)
downloadNim-3575f2bf9ccdabe5fa1fcade086ef0c11adc67b5.tar.gz
fix #20972 fixes invalid and UB codegen case object transitions for both refc and ORC [backport] (#21611)
fix #20972 fixes invalid and UB codegen case object transitions for refc and ORC
Diffstat (limited to 'tests')
-rw-r--r--tests/objects/t20972.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/objects/t20972.nim b/tests/objects/t20972.nim
new file mode 100644
index 000000000..6383dc9b1
--- /dev/null
+++ b/tests/objects/t20972.nim
@@ -0,0 +1,15 @@
+discard """
+  matrix: "--mm:refc -d:release; --mm:orc -d:release"
+"""
+
+{.passC: "-fsanitize=undefined -fsanitize-undefined-trap-on-error -Wall -Wextra -pedantic -flto".}
+{.passL: "-fsanitize=undefined -fsanitize-undefined-trap-on-error -flto".}
+
+# bug #20972
+type ForkedEpochInfo = object
+  case kind: bool
+  of true, false: discard
+var info = ForkedEpochInfo(kind: true)
+doAssert info.kind
+info.kind = false
+doAssert not info.kind