C backend: errors and optionals

* bitcast treats all pointers as pointers
 * correctly unwrapping error unions with pointers
 * equality operators for primitive optional types
This commit is contained in:
Scibuild
2021-11-18 08:26:15 +11:00
committed by Andrew Kelley
parent 8f1e417757
commit 2e15a404e2
4 changed files with 79 additions and 28 deletions

View File

@@ -18,25 +18,6 @@ test "passing an optional integer as a parameter" {
comptime try expect(S.entry());
}
test "self-referential struct through a slice of optional" {
const S = struct {
const Node = struct {
children: []?Node,
data: ?u8,
fn new() Node {
return Node{
.children = undefined,
.data = null,
};
}
};
};
var n = S.Node.new();
try expect(n.data == null);
}
pub const EmptyStruct = struct {};
test "optional pointer to size zero struct" {