disallow alignment on packed union fields
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
export fn entry() void {
|
||||
_ = @Type(.{ .@"struct" = .{ .layout = .@"packed", .fields = &.{
|
||||
.{ .name = "one", .type = u4, .default_value_ptr = null, .is_comptime = false, .alignment = 2 },
|
||||
}, .decls = &.{}, .is_tuple = false } });
|
||||
}
|
||||
|
||||
// error
|
||||
//
|
||||
// :2:9: error: alignment in a packed struct field must be set to 0
|
||||
@@ -0,0 +1,9 @@
|
||||
const U = packed union {
|
||||
x: f32,
|
||||
y: u8 align(10),
|
||||
z: u32,
|
||||
};
|
||||
|
||||
// error
|
||||
//
|
||||
// :3:17: error: unable to override alignment of packed union fields
|
||||
@@ -75,4 +75,5 @@ comptime {
|
||||
// :16:5: error: tuple field name '3' does not match field index 0
|
||||
// :30:5: error: comptime field without default initialization value
|
||||
// :44:5: error: extern struct fields cannot be marked comptime
|
||||
// :58:5: error: alignment in a packed struct field must be set to 0
|
||||
// :58:5: error: alignment of a packed struct field must be set to 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user