fn flagsType(flags: []const Flag) type {
var names: [1 + flags.len][]const u8 = undefined;
var types: [1 + flags.len]type = undefined;
var atts: [1 + flags.len]std.builtin.Type.StructField.Attributes = undefined;
names[0], types[0], atts[0] = .{ "raw_text", []const []const u8, .{} };
for (names[1..], types[1..], atts[1..], flags) |*_name, *t, *att, flag| {
_name.*, t.*, att.* = .{
flag.name(),
if (flag.type) |_t| ?_t.type else bool,
.{ .default_value_ptr = &(if (flag.type) |_| null else false) },
};
}
return @Struct(.auto, null, &names, &types, &atts);
}
Creates the compiler warning
src/Command.zig:284:53: error: comptime dereference requires '?[]u8' to have a well-defined layout
return @Struct(.auto, null, &names, &types, &atts);
^~~~~
Version is Zig 0.16.0
PS: there is no tag for 0.16.0 yet