aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/self_referential_struct_requires_comptime.zig
blob: 3ce75710267c485a69bab33e3d132d2b26b1a836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const S = struct {
    a: fn () void,
    b: *S,
};
pub export fn entry() void {
    var s: S = undefined;
    _ = s;
}


// error
// backend=stage2
// target=native
//
// :6:12: error: variable of type 'tmp.S' must be const or comptime
// :2:8: note: struct requires comptime because of this field
// :2:8: note: use '*const fn() void' for a function pointer type
// :3:8: note: struct requires comptime because of this field