-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fmt::format/print(FMT_STRING("noarg string")) is broken in gcc with c++11 set. #2039
Comments
|
That sort of surprises me - There's no such requirement documented anywhere I could find, including in the tests, and it seems to work just fine in gcc 4.8 with -std=c++11 as long as there are no formatting errors, and more than one argument is passed. What do we want to do here, just add docs? It seems to me it'd be better to add some kind of enforcement, but I'll put together a doc change first. |
Ah, you are right. |
Repro case is in the title, and remains unresolved: https://godbolt.org/z/azTEns. It appears to be triggered on all versions of GCC. This issue is similar to but different from the one referred to and fixed in #2042 - Edit: my bad. The issue is that in GCC with -c++11, FMT_STRING just doesn't cause compile-time code generation, not that it fails to compile normally. It will fail to compile when placed in format-test.cc due to the additional checks added by FMT_PEDANTIC however. I'm currently trying to repro that with godbolt |
That part is expected:
|
Yeah, that PR turned out to be unrelated. |
Update - I cannot seem to replicate this with godbolt. Locally it was failing to compile with -Warray-bounds but wiping cache seems to have resolved it. Sorry for the fuss |
No worries, glad it's resolved now. |
Could we re-open this? I'm now seeing it again both locally and on the build servers for #2049 |
Sure, but please provide a repro. |
Found while working on #2038. Adding
to format-test.cc creates completely inscrutable error messages. The underlying issue appears to be a problem with make_args_checked when called with zero arguments in the parameter pack. This should either be worked around, or a platform dependent static assert added to make this error message more tractable and the limitation documented.
Arguably this is an incorrect use of the API anyways, but a better error message could likely save someone pain. It just shows up as a index out of range error in format.h, and since it only happens in GCC, there's basically no info about which source line actually caused it.
The text was updated successfully, but these errors were encountered: