aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/self_hosted.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/self_hosted.zig b/test/self_hosted.zig
index 8c6c9112e4..36c0cc9d6f 100644
--- a/test/self_hosted.zig
+++ b/test/self_hosted.zig
@@ -1566,3 +1566,15 @@ fn c_string_concatenation() {
assert(a[len] == 0);
assert(b[len] == 0);
}
+
+#attribute("test")
+fn generic_struct() {
+ var a1 = GenNode(i32) {.value = 13, .next = null,};
+ var b1 = GenNode(bool) {.value = true, .next = null,};
+ assert(a1.value == 13);
+ assert(b1.value);
+}
+struct GenNode(T: type) {
+ value: T,
+ next: ?&GenNode(T),
+}