diff options
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig b/test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig new file mode 100644 index 0000000000..dc57ded029 --- /dev/null +++ b/test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig @@ -0,0 +1,50 @@ +comptime { + _ = @Type(.{ + .Union = .{ + .layout = .Auto, + .tag_type = null, + .fields = &.{ + .{ .name = "foo", .type = usize, .alignment = 3 }, + }, + .decls = &.{}, + }, + }); +} +comptime { + _ = @Type(.{ + .Struct = .{ + .layout = .Auto, + .fields = &.{.{ + .name = "0", + .type = u32, + .default_value = null, + .is_comptime = true, + .alignment = 5, + }}, + .decls = &.{}, + .is_tuple = false, + }, + }); +} +comptime { + _ = @Type(.{ + .Pointer = .{ + .size = .Many, + .is_const = true, + .is_volatile = false, + .alignment = 7, + .address_space = .generic, + .child = u8, + .is_allowzero = false, + .sentinel = null, + }, + }); +} + +// error +// backend=stage2 +// target=native +// +// :2:9: error: alignment value '3' is not a power of two or zero +// :14:9: error: alignment value '5' is not a power of two or zero +// :30:9: error: alignment value '7' is not a power of two or zero |
