| ... | ... | @@ -23338,6 +23338,12 @@ static IrInstruction *ir_analyze_ptr_cast(IrAnalyze *ira, IrInstruction *source_ |
| 23338 | 23338 | |
| 23339 | 23339 | IrInstruction *casted_ptr = ir_build_ptr_cast_gen(ira, source_instr, dest_type, ptr, safety_check_on); |
| 23340 | 23340 | |
| 23341 | if ((err = type_resolve(ira->codegen, dest_type, ResolveStatusZeroBitsKnown))) |
| 23342 | return ira->codegen->invalid_instruction; |
| 23343 | |
| 23344 | if ((err = type_resolve(ira->codegen, src_type, ResolveStatusZeroBitsKnown))) |
| 23345 | return ira->codegen->invalid_instruction; |
| 23346 | |
| 23341 | 23347 | if (type_has_bits(dest_type) && !type_has_bits(src_type)) { |
| 23342 | 23348 | ErrorMsg *msg = ir_add_error(ira, source_instr, |
| 23343 | 23349 | buf_sprintf("'%s' and '%s' do not have the same in-memory representation", |
| ... | ... | @@ -25435,6 +25441,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 25435 | 25441 | static ZigType *ir_resolve_lazy_fn_type(CodeGen *codegen, IrExecutable *exec, AstNode *source_node, |
| 25436 | 25442 | LazyValueFnType *lazy_fn_type) |
| 25437 | 25443 | { |
| 25444 | Error err; |
| 25438 | 25445 | AstNode *proto_node = lazy_fn_type->proto_node; |
| 25439 | 25446 | |
| 25440 | 25447 | FnTypeId fn_type_id = {0}; |
| ... | ... | @@ -25482,11 +25489,15 @@ static ZigType *ir_resolve_lazy_fn_type(CodeGen *codegen, IrExecutable *exec, As |
| 25482 | 25489 | case ReqCompTimeNo: |
| 25483 | 25490 | break; |
| 25484 | 25491 | } |
| 25485 | | if (!type_has_bits(param_type) && !calling_convention_allows_zig_types(fn_type_id.cc)) { |
| 25486 | | exec_add_error_node(codegen, exec, source_node, |
| 25487 | | buf_sprintf("parameter of type '%s' has 0 bits; not allowed in function with calling convention '%s'", |
| 25488 | | buf_ptr(&param_type->name), calling_convention_name(fn_type_id.cc))); |
| 25489 | | return nullptr; |
| 25492 | if (!calling_convention_allows_zig_types(fn_type_id.cc)) { |
| 25493 | if ((err = type_resolve(codegen, param_type, ResolveStatusZeroBitsKnown))) |
| 25494 | return nullptr; |
| 25495 | if (!type_has_bits(param_type)) { |
| 25496 | exec_add_error_node(codegen, exec, source_node, |
| 25497 | buf_sprintf("parameter of type '%s' has 0 bits; not allowed in function with calling convention '%s'", |
| 25498 | buf_ptr(&param_type->name), calling_convention_name(fn_type_id.cc))); |
| 25499 | return nullptr; |
| 25500 | } |
| 25490 | 25501 | } |
| 25491 | 25502 | param_info->type = param_type; |
| 25492 | 25503 | } |