summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-03-07 20:17:05 +0800
committerGitHub <noreply@github.com>2023-03-07 20:17:05 +0800
commit2f89f1eb780ab32be31dbe4074af70b587ad2f36 (patch)
tree07f500587ca4b2fcadc9e0506a22283599acbf07
parent6ef94301538f0a17461630c08c456112954e66bb (diff)
downloadNim-2f89f1eb780ab32be31dbe4074af70b587ad2f36.tar.gz
closes #8295; add a test case (#21486)
-rw-r--r--tests/generics/tgeneric0.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/generics/tgeneric0.nim b/tests/generics/tgeneric0.nim
index 44c34917d..b5e1c4bb4 100644
--- a/tests/generics/tgeneric0.nim
+++ b/tests/generics/tgeneric0.nim
@@ -153,3 +153,16 @@ proc unzip*[T,U](xs: List[tuple[t: T, u: U]]): (List[T], List[U]) = discard
 
 proc unzip2*[T,U](xs: List[(T,U)]): (List[T], List[U]) = discard
 
+type
+  AtomicType = pointer|ptr|int
+
+  Atomic[T: AtomicType] = distinct T
+
+  Block[T: AtomicType] = object
+
+  AtomicContainer[T: AtomicType] = object
+    b: Atomic[ptr Block[T]]
+
+# bug #8295
+var x = AtomicContainer[int]()
+doAssert (ptr Block[int])(x.b) == nil