aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/self_referential_union_requires_comptime.zig
blob: 6ab0af996596a9bc021466ff95d71c2ff6ec79db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const U = union {
    a: fn () void,
    b: *U,
};
pub export fn entry() void {
    var u: U = undefined;
    _ = &u;
}

// error
//
// :6:12: error: variable of type 'tmp.U' must be const or comptime
// :2:8: note: union requires comptime because of this field
// :2:8: note: use '*const fn () void' for a function pointer type
// :3:8: note: union requires comptime because of this field