authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-28 11:52:48-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-28 11:52:48-05:00
log5c55a9b4e8d6d1f5ee3548cf8033e7e69951b308
treeb7a1bf0e13822ff8faa5d34718376cc0c8478bd9
parent287d3c37e1f53b6f0a0b29753b68254001194e62
signature Commit is signed but in an unrecognized format.

fix compile error regression with struct containing itself


1 files changed, 4 insertions(+), 0 deletions(-)

src/analyze.cpp+4
...@@ -5641,6 +5641,8 @@ OnePossibleValue type_has_one_possible_value(CodeGen *g, ZigType *type_entry) {...@@ -5641,6 +5641,8 @@ OnePossibleValue type_has_one_possible_value(CodeGen *g, ZigType *type_entry) {
5641 return OnePossibleValueYes;5641 return OnePossibleValueYes;
5642 return type_has_one_possible_value(g, type_entry->data.array.child_type);5642 return type_has_one_possible_value(g, type_entry->data.array.child_type);
5643 case ZigTypeIdStruct:5643 case ZigTypeIdStruct:
5644 // If the recursive function call asks, then we are not one possible value.
5645 type_entry->one_possible_value = OnePossibleValueNo;
5644 for (size_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) {5646 for (size_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
5645 TypeStructField *field = type_entry->data.structure.fields[i];5647 TypeStructField *field = type_entry->data.structure.fields[i];
5646 OnePossibleValue opv = (field->type_entry != nullptr) ?5648 OnePossibleValue opv = (field->type_entry != nullptr) ?
...@@ -5648,6 +5650,7 @@ OnePossibleValue type_has_one_possible_value(CodeGen *g, ZigType *type_entry) {...@@ -5648,6 +5650,7 @@ OnePossibleValue type_has_one_possible_value(CodeGen *g, ZigType *type_entry) {
5648 type_val_resolve_has_one_possible_value(g, field->type_val);5650 type_val_resolve_has_one_possible_value(g, field->type_val);
5649 switch (opv) {5651 switch (opv) {
5650 case OnePossibleValueInvalid:5652 case OnePossibleValueInvalid:
5653 type_entry->one_possible_value = OnePossibleValueInvalid;
5651 return OnePossibleValueInvalid;5654 return OnePossibleValueInvalid;
5652 case OnePossibleValueNo:5655 case OnePossibleValueNo:
5653 return OnePossibleValueNo;5656 return OnePossibleValueNo;
...@@ -5655,6 +5658,7 @@ OnePossibleValue type_has_one_possible_value(CodeGen *g, ZigType *type_entry) {...@@ -5655,6 +5658,7 @@ OnePossibleValue type_has_one_possible_value(CodeGen *g, ZigType *type_entry) {
5655 continue;5658 continue;
5656 }5659 }
5657 }5660 }
5661 type_entry->one_possible_value = OnePossibleValueYes;
5658 return OnePossibleValueYes;5662 return OnePossibleValueYes;
5659 case ZigTypeIdErrorSet:5663 case ZigTypeIdErrorSet:
5660 case ZigTypeIdEnum:5664 case ZigTypeIdEnum: