diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-08-12 23:18:05 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-08-13 11:36:16 +0100 |
| commit | ba6abd71c2d3664bc658cf5ce55b5c53052dc720 (patch) | |
| tree | 116c178b6877cbf07abbeec681768adbaebd7449 /src/codegen | |
| parent | 38ba425b26312ea073c7082e576e8583913139d7 (diff) | |
| download | zig-ba6abd71c2d3664bc658cf5ce55b5c53052dc720.tar.gz zig-ba6abd71c2d3664bc658cf5ce55b5c53052dc720.zip | |
llvm: unions which are equivalent to enums are not by-ref
The LLVM backend lowers unions where all fields are zero-bit as
equivalent to their backing enum, and expects them to have the same
by-ref-ness in at least one place in the backend, probably more.
Resolves: #23577
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/llvm.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index bccb67ec3c..1aa8e86a7f 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -12777,7 +12777,7 @@ fn isByRef(ty: Type, zcu: *Zcu) bool { }, .@"union" => switch (ty.containerLayout(zcu)) { .@"packed" => return false, - else => return ty.hasRuntimeBits(zcu), + else => return ty.hasRuntimeBits(zcu) and !ty.unionHasAllZeroBitFieldTypes(zcu), }, .error_union => { const payload_ty = ty.errorUnionPayload(zcu); |
