From 365aca0e9096ef7c69b3ba2eb682caf3f7234293 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 3 Mar 2022 13:11:06 -0700 Subject: Sema: allow pointers to opaques to be aligned --- src/type.zig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/type.zig') 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, -- cgit v1.2.3