LYR-PAR0062
a 'comptime for' in an initializer without '[f] = e'
In an initializer, a comptime for (f in …) is followed by something else than an item [f] = e.
Explanation
A comptime for in an initializer sets one field per round, the field its variable names: Point { comptime for (f in fields<Point>()) [f] = 0 }. A field written by its own name would be set once per round.
Write the item as [f] = value.
Wrong
import std.meta { fields };
struct Point { x: int, y: int }
fn main(): void {
let p = Point { comptime for (f in fields<Point>()) x = 0 };
let _ = p.x;
}
Right
import std.meta { fields };
struct Point { x: int, y: int }
fn main(): void {
let p = Point { comptime for (f in fields<Point>()) [f] = 0 };
let _ = p.x;
}