| ... | @@ -429,7 +429,7 @@ TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) { | ... | @@ -429,7 +429,7 @@ TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) { |
| 429 | ensure_complete_type(g, child_type); | 429 | ensure_complete_type(g, child_type); |
| 430 | | 430 | |
| 431 | TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdMaybe); | 431 | TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdMaybe); |
| 432 | assert(child_type->type_ref); | 432 | assert(child_type->type_ref || child_type->zero_bits); |
| 433 | assert(child_type->di_type); | 433 | assert(child_type->di_type); |
| 434 | entry->is_copyable = type_is_copyable(g, child_type); | 434 | entry->is_copyable = type_is_copyable(g, child_type); |
| 435 | | 435 | |
| ... | @@ -1162,6 +1162,15 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c | ... | @@ -1162,6 +1162,15 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c |
| 1162 | } | 1162 | } |
| 1163 | | 1163 | |
| 1164 | TypeTableEntry *type_entry = analyze_type_expr(g, child_scope, param_node->data.param_decl.type); | 1164 | TypeTableEntry *type_entry = analyze_type_expr(g, child_scope, param_node->data.param_decl.type); |
| | 1165 | if (fn_type_id.cc != CallingConventionUnspecified) { |
| | 1166 | type_ensure_zero_bits_known(g, type_entry); |
| | 1167 | if (!type_has_bits(type_entry)) { |
| | 1168 | add_node_error(g, param_node->data.param_decl.type, |
| | 1169 | buf_sprintf("parameter of type '%s' has 0 bits; not allowed in function with calling convention '%s'", |
| | 1170 | buf_ptr(&type_entry->name), calling_convention_name(fn_type_id.cc))); |
| | 1171 | return g->builtin_types.entry_invalid; |
| | 1172 | } |
| | 1173 | } |
| 1165 | | 1174 | |
| 1166 | switch (type_entry->id) { | 1175 | switch (type_entry->id) { |
| 1167 | case TypeTableEntryIdInvalid: | 1176 | case TypeTableEntryIdInvalid: |