-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Compiler crashes when using a struct T which contains a field of type ArrayList(T) #1832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can reproduce with |
I get:
on 0.3.0+82bf1eb7 built from source. |
I get nio output using the pre-built binaries on windows. Different platforms might produce different output. But that do seem like valuable information! |
Smaller test case: test "" {
var n: Node = undefined;
}
const Node = struct {
nodes: []align(@alignOf(Node)) Node,
}; |
Funny enough, i am running into this too -- but I am wondering why the standard library is not failing given some of the JSON code relies on this.
|
callstack:
|
Seems like the call to analyze.cpp ZigType *field_type;
if (field_node->data.struct_field.type == nullptr) {
if (decl_node->data.container_decl.auto_enum || decl_node->data.container_decl.init_arg_expr != nullptr) {
field_type = g->builtin_types.entry_void;
} else {
add_node_error(g, field_node, buf_sprintf("union field missing type"));
union_type->data.unionation.is_invalid = true;
continue;
}
} else {
field_type = analyze_type_expr(g, scope, field_node->data.struct_field.type);
--> if ((err = type_resolve(g, field_type, ResolveStatusAlignmentKnown))) {
union_type->data.unionation.is_invalid = true;
continue;
}
}
--> union_field->type_entry = field_type; |
Replacing test "" {
var n: Node = undefined;
}
const Node = struct {
nodes: []align(1) Node,
};
|
When running the code below zig fails without printing any information as to what went wrong (or any other information for that matter). No files are being created either.
I'm expecting the compiler to tell me if I do something wrong.
Zig version:
Platform:
Return Code:
Code:
The text was updated successfully, but these errors were encountered: