-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<format>: dynamic width or precision of non-integral type should be rejected #2785
Comments
Currently It might be possible to e.g. make (Aside: MSVC STL requires |
The sentence is changed in C++26 by WG21-P2757R3, which seemingly claims that a very similar case (
|
The paper is confused. That case (and the case in this thread) are clearly ill-formed per [format.fmt.string]/3. The issue the paper actually addresses is that [format.fmt.string]/3 isn't implementable for non-Standard format arguments with the current machinery in the Standard. |
Thanks. It seems that we should treat the wording change in that paragraph editorial... |
@StephanTLavavej To answer your question in #4152. I believe it's not incorrect since C++23, but since C++20.
Since the value is not a "standard signed or unsigned integer type". It's not valid. The wording in C++20 was slightly different |
Describe the bug
Per [format.string.std]/7
When using a non-integral type as arg-id in
std::format
the code violates [format.fmt.string]/3 and is therefore ill-formed. The STL incorrectly accepts the format string, however, and throws an exception at run-time https://godbolt.org/z/b868c3M8z.The text was updated successfully, but these errors were encountered: