mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
This logic was previously in Sema, which was unnecessary complexity, and meant the issue was not detected unless the declaration was semantically analyzed. This commit finishes the work which 941090d started.
Resolves: #17916
33 lines
572 B
Zig
33 lines
572 B
Zig
const Foo = struct {
|
|
Bar: i32,
|
|
Bar: usize,
|
|
};
|
|
|
|
const S = struct {
|
|
a: u32,
|
|
b: u32,
|
|
a: u32,
|
|
a: u64,
|
|
};
|
|
|
|
export fn a() void {
|
|
const f: Foo = undefined;
|
|
_ = f;
|
|
}
|
|
|
|
export fn b() void {
|
|
const s: S = undefined;
|
|
_ = s;
|
|
}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :2:5: error: duplicate struct field name
|
|
// :3:5: note: duplicate field here
|
|
// :1:13: note: struct declared here
|
|
// :7:5: error: duplicate struct field name
|
|
// :9:5: note: duplicate field here
|
|
// :10:5: note: duplicate field here
|
|
// :6:11: note: struct declared here
|