diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-09-05 10:43:35 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-09-05 10:43:35 -0400 |
| commit | a76a72469bf5980946fad8f8e60f07edde543ce5 (patch) | |
| tree | 8a4f5bba088b64e26d13c0e509bfd66ba3d64224 /src/ir.cpp | |
| parent | 3e94650ef7bd2407fb0aca11ad19a93b90a14b7c (diff) | |
| download | zig-a76a72469bf5980946fad8f8e60f07edde543ce5.tar.gz zig-a76a72469bf5980946fad8f8e60f07edde543ce5.zip | |
stage1: fix crash when invalid type used in array type
closes #1186
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 1b7bf8aa08..36d8100c84 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -15474,6 +15474,8 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, IrInstructionArrayType *array_type_instruction) { + Error err; + IrInstruction *size_value = array_type_instruction->size->other; uint64_t size; if (!ir_resolve_usize(ira, size_value, &size)) @@ -15515,6 +15517,8 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, case TypeTableEntryIdBoundFn: case TypeTableEntryIdPromise: { + if ((err = ensure_complete_type(ira->codegen, child_type))) + return ira->codegen->builtin_types.entry_invalid; TypeTableEntry *result_type = get_array_type(ira->codegen, child_type, size); ConstExprValue *out_val = ir_build_const_from(ira, &array_type_instruction->base); out_val->data.x_type = result_type; |
