self-referential c record imports

This commit is contained in:
2026-06-25 07:43:43 +02:00
parent 4cb0ad7f25
commit 9d1130b359
8 changed files with 65 additions and 8 deletions
+16
View File
@@ -0,0 +1,16 @@
native :: import "../include/native.h"
# Exercises a self-referential imported C record (`struct Node { struct Node *next; int value; }`):
# the importer must not recurse forever populating it, and the checker must accept the
# self-referential `?*mut Node` field as C-layout-compatible.
main :: func() i32 {
node native.Node = native.Node { next = none, value = 7 }
if node.next |_| {
return 1
}
if node.value == 7 {
return 0
}
return 2
}