You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This results in a compile time failure reporting an "unmatched '}' in format string". This is happening in VS17.14 Preview 1 and with GCC 14.2. I've reproduced the issue over on godbolt using {fmt} from trunk [0]. The above string compiled with 11.0.2 and fails with 11.1.3. I was unable to reproduce this compile failure within the {fmt} test code, so I was wondering if it was somehow fixed. However, checking out the tag for 11.1.3 locally, I was also unable to repro in the test code. Not sure what that's about.
If you wrap the above example into an fmt::runtime(), compilation is successful and output is what is expected. The godbolt link includes this example. Additionally, other format variations appear to work both with auto-indexed values as well as when not providing any explicit reference. The following example does compile. It also appears to be related to the dynamic width field as an explicit value there will compile.
Wanted to add another update as I was playing around with the UDL for args. It turns out that using the UDLs will also allow the format string to properly compile. That means switching to this is also another workaround. Does that mean this has something to do with named_arg since the static_named_arg seems to work?
I believe I've found a solution. Will post a PR later today. Short of it is, handling of format specs with dynamic named args would exit early because of the nested named replacement field. Static named args are fine because their parser func would be called, but for dynamic, a simple loop looking for the next } would exit too soon because of the nested replacement.
Consider the following format call.
This results in a compile time failure reporting an "unmatched '}' in format string". This is happening in VS17.14 Preview 1 and with GCC 14.2. I've reproduced the issue over on godbolt using {fmt} from trunk [0]. The above string compiled with 11.0.2 and fails with 11.1.3. I was unable to reproduce this compile failure within the {fmt} test code, so I was wondering if it was somehow fixed. However, checking out the tag for 11.1.3 locally, I was also unable to repro in the test code. Not sure what that's about.
If you wrap the above example into an
fmt::runtime()
, compilation is successful and output is what is expected. The godbolt link includes this example. Additionally, other format variations appear to work both with auto-indexed values as well as when not providing any explicit reference. The following example does compile. It also appears to be related to the dynamic width field as an explicit value there will compile.Full error output from GCC 14.2:
[0] https://godbolt.org/z/qvxo5qrTf
The text was updated successfully, but these errors were encountered: