diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-25 20:27:56 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-25 20:27:56 -0400 |
| commit | 64e9b0ee4673bf79d42ea14e354b324308f90b93 (patch) | |
| tree | 5f6ddd1a1f84f9bd8fdfe752d6a8542cb51b7565 /src/ir.cpp | |
| parent | 8f41da221690a8dbbbce41a07513715b9a31e70a (diff) | |
| download | zig-64e9b0ee4673bf79d42ea14e354b324308f90b93.tar.gz zig-64e9b0ee4673bf79d42ea14e354b324308f90b93.zip | |
make the zero-bit-ness of pointers lazy
this case works now:
```zig
const Foo = struct {
field: @typeOf(func).ReturnType,
};
fn func(self: *Foo) void {}
```
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 558dbca265..3aabb4995f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -25582,12 +25582,12 @@ static Error ir_resolve_lazy_raw(CodeGen *codegen, AstNode *source_node, ConstEx } } - ResolveStatus needed_status = (align_bytes == 0) ? - ResolveStatusZeroBitsKnown : ResolveStatusAlignmentKnown; - if ((err = type_resolve(codegen, elem_type, needed_status))) - return err; - if (!type_has_bits(elem_type)) - align_bytes = 0; + if (align_bytes != 0) { + if ((err = type_resolve(codegen, elem_type, ResolveStatusAlignmentKnown))) + return err; + if (!type_has_bits(elem_type)) + align_bytes = 0; + } bool allow_zero = lazy_ptr_type->is_allowzero || lazy_ptr_type->ptr_len == PtrLenC; assert(val->type->id == ZigTypeIdMetaType); val->data.x_type = get_pointer_to_type_extra(codegen, elem_type, |
