ability to slice an undefined pointer at compile time if the len is 0

This commit is contained in:
Andrew Kelley
2018-02-16 15:22:29 -05:00
parent cbbd6cfa1e
commit 72ca2b214d
5 changed files with 63 additions and 27 deletions

View File

@@ -4201,6 +4201,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
continue;
}
ConstExprValue *field_val = &const_val->data.x_struct.fields[i];
assert(field_val->type != nullptr);
LLVMValueRef val = gen_const_val(g, field_val, "");
fields[type_struct_field->gen_index] = val;
make_unnamed_struct = make_unnamed_struct || is_llvm_value_unnamed_type(field_val->type, val);