comptime
should not be allowed in type expressions: e.g. var foo: comptime u64
#3976
Labels
Milestone
A comptime variable in zig uses the syntax
comptime var foo: u64
, however the compiler also acceptsvar foo: comptime u64
. The compiler seems treat the latter case as equivalent tovar foo: u64
, but I think it should be a syntax error.For example this program will compile and run without errors:
On a slightly related note, the zig grammar in the docs seems to be very wrong/outdated (e.g. a
CHAR_LITERAL
would be a validTypeExpr
), but that's probably a separate issue.The text was updated successfully, but these errors were encountered: