aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/coerce_empty_tuple_to_struct.zig
blob: 9ed4ece3daadd76fe09951a30c9caf5a1829b59c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const empty = .{};

const Foo = struct {};
const foo: Foo = empty;

const Bar = struct { a: u32 };
const bar: Bar = empty;

comptime {
    _ = foo;
}
comptime {
    _ = bar;
}

// error
//
// :4:18: error: expected type 'tmp.Foo', found '@TypeOf(.{})'
// :3:13: note: struct declared here
// :7:18: error: expected type 'tmp.Bar', found '@TypeOf(.{})'
// :6:13: note: struct declared here