diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-23 15:59:37 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-23 15:59:37 -0400 |
| commit | f0034495fa74d7a2c36e4a75520f030bb0cdb16a (patch) | |
| tree | ddad397e31b2b9b06f22130bbc5be9da165e041c /src | |
| parent | ac4dd9d665ba195a6b21b3b033f27c865015ccac (diff) | |
| download | zig-f0034495fa74d7a2c36e4a75520f030bb0cdb16a.tar.gz zig-f0034495fa74d7a2c36e4a75520f030bb0cdb16a.zip | |
fix regression with simple pointer to self
Diffstat (limited to 'src')
| -rw-r--r-- | src/analyze.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index f6e8a77770..0b65210eea 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -961,6 +961,13 @@ static Error type_val_resolve_zero_bits(CodeGen *g, ConstExprValue *type_val, Zi Error err; if (type_val->special != ConstValSpecialLazy) { assert(type_val->special == ConstValSpecialStatic); + if (type_val->data.x_type->id == ZigTypeIdStruct && + type_val->data.x_type->data.structure.resolve_loop_flag_zero_bits) + { + // Does a struct which contains a pointer field to itself have bits? Yes. + *is_zero_bits = false; + return ErrorNone; + } if ((err = type_resolve(g, type_val->data.x_type, ResolveStatusZeroBitsKnown))) return err; *is_zero_bits = (type_val->data.x_type->abi_size == 0); |
