aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/runtime_value_in_comptime_struct.zig
blob: acaef3c543274869524a3d96361a7c39f8c045f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
fn comptimeStruct(comptime _: anytype) void {}
fn bar() u8 {
    return 123;
}
export fn entry() void {
    const y = bar();
    comptimeStruct(.{ .foo = y });
}

// error
//
// :7:21: error: unable to resolve comptime value
// :7:21: note: argument to comptime parameter must be comptime-known
// :1:19: note: parameter declared comptime here