diff options
| author | Cody Tapscott <topolarity@tapscott.me> | 2022-03-02 21:52:49 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-03 13:08:14 -0700 |
| commit | b6a6f05c0d139ebb572bbc6672d8ecfe5e63d89f (patch) | |
| tree | 323110982fdd6b4a1a76a9388eb2bf14b4d5560a /src/type.zig | |
| parent | b6f1a8612bc5120b729f94031119315334e54e35 (diff) | |
| download | zig-b6a6f05c0d139ebb572bbc6672d8ecfe5e63d89f.tar.gz zig-b6a6f05c0d139ebb572bbc6672d8ecfe5e63d89f.zip | |
stage2: support @ptrCast for slices with an offset
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/type.zig b/src/type.zig index 63b506f890..10705dec6c 100644 --- a/src/type.zig +++ b/src/type.zig @@ -5287,8 +5287,10 @@ pub const Type = extern union { // type, we change it to 0 here. If this causes an assertion trip because the // pointee type needs to be resolved more, that needs to be done before calling // this ptr() function. - if (d.@"align" != 0 and d.@"align" == d.pointee_type.abiAlignment(target)) { - d.@"align" = 0; + if (d.@"align" != 0) { + if (d.pointee_type.zigTypeTag() == .Opaque or d.@"align" == d.pointee_type.abiAlignment(target)) { + d.@"align" = 0; + } } // Canonicalize host_size. If it matches the bit size of the pointee type, |
