aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/union_duplicate_enum_field.zig
blob: 3a350f923f9f1b3edc96b68c94a0be4d44eef1f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const E = enum { a, b };
const U = union(E) {
    a: u32,
    a: u32,
};

export fn foo() void {
    const u: U = .{ .a = 123 };
    _ = u;
}

// error
// target=native
//
// :3:5: error: duplicate union member name 'a'
// :4:5: note: duplicate name here
// :2:11: note: union declared here