self-referential c record imports
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
typedef struct Node {
|
||||
struct Node *next;
|
||||
int value;
|
||||
} Node;
|
||||
Reference in New Issue
Block a user