mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-08 06:44:27 +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
16 lines
284 B
Zig
16 lines
284 B
Zig
const Foo = union {
|
|
Bar: i32,
|
|
Bar: usize,
|
|
};
|
|
export fn entry() void {
|
|
const a: Foo = undefined;
|
|
_ = a;
|
|
}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :2:5: error: duplicate union field name
|
|
// :3:5: note: duplicate field here
|
|
// :1:13: note: union declared here
|