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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user