diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-03 13:11:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-03 13:11:06 -0700 |
| commit | 365aca0e9096ef7c69b3ba2eb682caf3f7234293 (patch) | |
| tree | e86a89067a08d9c14d01334b4f054b51637afdb8 /src | |
| parent | 85610a9aff70b3ef77ae63289f8adde1ce5cac37 (diff) | |
| download | zig-365aca0e9096ef7c69b3ba2eb682caf3f7234293.tar.gz zig-365aca0e9096ef7c69b3ba2eb682caf3f7234293.zip | |
Sema: allow pointers to opaques to be aligned
Diffstat (limited to 'src')
| -rw-r--r-- | src/type.zig | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/type.zig b/src/type.zig index 10705dec6c..a4dafec74a 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2245,6 +2245,7 @@ pub const Type = extern union { .prefetch_options, .export_options, .extern_options, + .@"opaque", => return 1, .fn_noreturn_no_args, // represents machine code; not a pointer @@ -2432,7 +2433,6 @@ pub const Type = extern union { .noreturn, .inferred_alloc_const, .inferred_alloc_mut, - .@"opaque", .var_args_param, .bound_fn, => unreachable, @@ -5287,10 +5287,8 @@ 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) { - if (d.pointee_type.zigTypeTag() == .Opaque or d.@"align" == d.pointee_type.abiAlignment(target)) { - d.@"align" = 0; - } + if (d.@"align" != 0 and d.@"align" == d.pointee_type.abiAlignment(target)) { + d.@"align" = 0; } // Canonicalize host_size. If it matches the bit size of the pointee type, |
