Open ephaeton opened 1 week ago
The breaking change was https://github.com/ziglang/zig/pull/18533
This parser is for use in decoding formatting strings. Since this is usually done at comptime, the usage of comptime_int usually works fine. If you're not working with formatting strings, you should probably be using your own parsing code. If you are working with format strings, you should be parsing them at comptime so you can validate them, if possible.
That said, there doesn't appear to be a reason for this code to not work at runtime.
Zig Version
0.14.0-dev.144+a31fe8aa3
Steps to Reproduce and Observed Behavior
Use a fresh project output by
zig init
and replacesrc/main.zig
with:When I try and compile this (with 0.12.0, 0.13.0, above cited 0.14.0 version), I get the following error:
You can see I'm using
ziege
, but that shouldn't matter, should it? I don't understand how this issue hasn't surfaced before, which makes me think it's a problem on my end. Then again, the code (see below) is the same in the repo as in myziege
managed installation. If you agree it's a generally applicable problem, fret not, the fix is trivial.Expected Behavior
The expectation is for this to compile (and work). We can track it down to the type information at https://github.com/ziglang/zig/blob/768b17755e7735b328b92212de2dd7018f78fb4b/lib/std/fmt.zig#L377 just as the compiler says - make
i
not acomptime_int
and the project compiles.Does a 7-byte change merit a PR?
I don't understand the logic behind it, though; observationally I can tell you that fixes "the" issue.