aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors
diff options
context:
space:
mode:
authorJulian <58199799+mov-rax@users.noreply.github.com>2022-10-03 05:05:12 -0500
committerGitHub <noreply@github.com>2022-10-03 13:05:12 +0300
commit32d755beb8d83a666100ca9455df51b93caff1fc (patch)
treef17274c9e85736b61dd3cb6cfcb5f2cd446caada /test/cases/compile_errors
parent2eb09092065715642e93d9cfd54196840a314bc0 (diff)
downloadzig-32d755beb8d83a666100ca9455df51b93caff1fc.tar.gz
zig-32d755beb8d83a666100ca9455df51b93caff1fc.zip
Sema: require reified packed struct fields to have zero alignment
Diffstat (limited to 'test/cases/compile_errors')
-rw-r--r--test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig b/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig
new file mode 100644
index 0000000000..8c17e9100b
--- /dev/null
+++ b/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig
@@ -0,0 +1,11 @@
+export fn entry() void {
+ _ = @Type(.{ .Struct = .{ .layout = .Packed, .fields = &.{
+ .{ .name = "one", .field_type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
+ }, .decls = &.{}, .is_tuple = false } });
+}
+
+// error
+// backend=stage2
+// target=native
+//
+// :2:9: error: alignment in a packed struct field must be set to 0