aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/duplicate_struct_field.zig
blob: bb1ba26445730f26837b626989ab93e8f0c29500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 member name 'Bar'
// :3:5: note: duplicate name here
// :1:13: note: struct declared here
// :7:5: error: duplicate struct member name 'a'
// :9:5: note: duplicate name here
// :10:5: note: duplicate name here
// :6:11: note: struct declared here