aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors
diff options
context:
space:
mode:
Diffstat (limited to 'test/compile_errors')
-rw-r--r--test/compile_errors/stage2/struct_duplicate_field_name.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/compile_errors/stage2/struct_duplicate_field_name.zig b/test/compile_errors/stage2/struct_duplicate_field_name.zig
new file mode 100644
index 0000000000..274dce4e4a
--- /dev/null
+++ b/test/compile_errors/stage2/struct_duplicate_field_name.zig
@@ -0,0 +1,15 @@
+const S = struct {
+ foo: u32,
+ foo: u32,
+};
+
+export fn entry() void {
+ const s: S = .{ .foo = 100 };
+ _ = s;
+}
+
+// duplicate struct field name
+//
+// :3:5: error: duplicate struct field: 'foo'
+// :2:5: note: other field here
+// :1:11: note: struct declared here