aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-07-27 22:40:54 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2023-07-28 19:27:08 -0400
commitc80609dfecb57a3830583eeeb3e0fce5860d657b (patch)
treed98fff3fdcccd7ab72d38b8ea3c85647e845f61b /src/Sema.zig
parent20f4216af5dc4d5cb547529a132d8682ce7b7536 (diff)
downloadzig-c80609dfecb57a3830583eeeb3e0fce5860d657b.tar.gz
zig-c80609dfecb57a3830583eeeb3e0fce5860d657b.zip
Sema: don't reorder tuple fields
This conflicts with anon structs which can be in-memory coercible but are never reordered. Closes #16242
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 4a4823df2d..4936d52238 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -33491,7 +33491,9 @@ fn resolveStructLayout(sema: *Sema, ty: Type) CompileError!void {
return sema.failWithOwnedErrorMsg(msg);
}
- if (struct_obj.layout == .Auto and mod.backendSupportsFeature(.field_reordering)) {
+ if (struct_obj.layout == .Auto and !struct_obj.is_tuple and
+ mod.backendSupportsFeature(.field_reordering))
+ {
const optimized_order = try mod.tmp_hack_arena.allocator().alloc(u32, struct_obj.fields.count());
for (struct_obj.fields.values(), 0..) |field, i| {