authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-23 15:59:37-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-23 15:59:37-04:00
logf0034495fa74d7a2c36e4a75520f030bb0cdb16a
treeddad397e31b2b9b06f22130bbc5be9da165e041c
parentac4dd9d665ba195a6b21b3b033f27c865015ccac
signaturelock-open Commit is signed but in an unrecognized format.

fix regression with simple pointer to self


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

src/analyze.cpp+7
...@@ -961,6 +961,13 @@ static Error type_val_resolve_zero_bits(CodeGen *g, ConstExprValue *type_val, Zi...@@ -961,6 +961,13 @@ static Error type_val_resolve_zero_bits(CodeGen *g, ConstExprValue *type_val, Zi
961 Error err;961 Error err;
962 if (type_val->special != ConstValSpecialLazy) {962 if (type_val->special != ConstValSpecialLazy) {
963 assert(type_val->special == ConstValSpecialStatic);963 assert(type_val->special == ConstValSpecialStatic);
964 if (type_val->data.x_type->id == ZigTypeIdStruct &&
965 type_val->data.x_type->data.structure.resolve_loop_flag_zero_bits)
966 {
967 // Does a struct which contains a pointer field to itself have bits? Yes.
968 *is_zero_bits = false;
969 return ErrorNone;
970 }
964 if ((err = type_resolve(g, type_val->data.x_type, ResolveStatusZeroBitsKnown)))971 if ((err = type_resolve(g, type_val->data.x_type, ResolveStatusZeroBitsKnown)))
965 return err;972 return err;
966 *is_zero_bits = (type_val->data.x_type->abi_size == 0);973 *is_zero_bits = (type_val->data.x_type->abi_size == 0);