aboutsummaryrefslogtreecommitdiff
path: root/src/AstGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-23 23:27:49 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-02-23 23:59:25 -0700
commit6249a24e81b9b3df3d5ca99b57f22470b9ac486c (patch)
tree7f9ad767459ce5c1227365368d9034576b04e018 /src/AstGen.zig
parent65c04759709a64d1ad0529623bab804b97c02cbc (diff)
downloadzig-6249a24e81b9b3df3d5ca99b57f22470b9ac486c.tar.gz
zig-6249a24e81b9b3df3d5ca99b57f22470b9ac486c.zip
stage2: integer-backed packed structs
This implements #10113 for the self-hosted compiler only. It removes the ability to override alignment of packed struct fields, and removes the ability to put pointers and arrays inside packed structs. After this commit, nearly all the behavior tests pass for the stage2 llvm backend that involve packed structs. I didn't implement the compile errors or compile error tests yet. I'm waiting until we have stage2 building itself and then I want to rework the compile error test harness with inspiration from Vexu's arocc test harness. At that point it should be a much nicer dev experience to work on compile errors.
Diffstat (limited to 'src/AstGen.zig')
-rw-r--r--src/AstGen.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 1b2f598ace..8e2362ade1 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -4002,6 +4002,9 @@ fn structDeclInner(
wip_members.nextField(bits_per_field, .{ have_align, have_value, is_comptime, unused });
if (have_align) {
+ if (layout == .Packed) {
+ try astgen.appendErrorNode(member.ast.align_expr, "unable to override alignment of packed struct fields", .{});
+ }
const align_inst = try expr(&block_scope, &namespace.base, align_rl, member.ast.align_expr);
wip_members.appendToField(@enumToInt(align_inst));
}