diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-11-11 13:18:16 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-11-11 13:18:16 -0500 |
| commit | 1bca8e693d42256d575c76fbab5c68d86c0c4bc3 (patch) | |
| tree | 6b0f6d80f83eb13a719d32bcbbacb38d1a0551a4 /src | |
| parent | d4e6a6d5e27df845d47b254aab9d14f44d68d620 (diff) | |
| download | zig-1bca8e693d42256d575c76fbab5c68d86c0c4bc3.tar.gz zig-1bca8e693d42256d575c76fbab5c68d86c0c4bc3.zip | |
fix anon literal used with return result loc
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index f1b31af582..e278193785 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -6151,7 +6151,11 @@ static IrInstruction *ir_gen_container_init_expr(IrBuilder *irb, Scope *scope, A init_array_type_source_node = container_type->source_node; } else { child_result_loc = parent_result_loc; - init_array_type_source_node = parent_result_loc->source_instruction->source_node; + if (parent_result_loc->source_instruction != nullptr) { + init_array_type_source_node = parent_result_loc->source_instruction->source_node; + } else { + init_array_type_source_node = node; + } } switch (kind) { @@ -15935,6 +15939,10 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, instruction->result_loc->source_instruction->child); if (type_is_invalid(implicit_elem_type)) return ira->codegen->invalid_instruction; + } else if (instruction->result_loc->id == ResultLocIdReturn) { + implicit_elem_type = ira->explicit_return_type; + if (type_is_invalid(implicit_elem_type)) + return ira->codegen->invalid_instruction; } else { Buf *bare_name = buf_alloc(); Buf *name = get_anon_type_name(ira->codegen, nullptr, container_string(ContainerKindStruct), |
