Files
brolang/examples/interop/recursive/app/main.bro
T
2026-07-22 00:07:42 +02:00

17 lines
449 B
Plaintext

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 = null, value = 7 }
if node.next |_| {
return 1
}
if node.value == 7 {
return 0
}
return 2
}