aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/self_referential_struct_requires_comptime.zig
blob: ec3b4c1795ba81862b28098034c93d11efaaa97b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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