-
Notifications
You must be signed in to change notification settings - Fork 1.6k
format (and friends) should reject volatile arguments #2579
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
Conversation
... for now, at least. This corrects a defect in our implementation of [[format.args]/4](https://eel.is/c++draft/format.arg#4)'s requirement that: > ```c++ > typename Context::template formatter_type<remove_cvref_t<T>>() > .format(declval<T&>(), declval<Context&>()) > ``` be a valid expression. We were incorrectly stripping cv-qualifiers from `T`.
|
I'm open to suggestions for test coverage. I did verify that this program: #include <format>
#include <iostream>
int main() {
volatile int v = 42;
std::cout << std::format("{}\n", v);
}was accepted before and rejected after the change, but it's hard to do "correctly fails to compile" tests internally. |
|
Should your PR also close the issue #2427 ? Also the issue says that works. Should it be rejected too? |
miscco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we have to wait for libc++ for compile.fail tests
|
Looks good to me. After reading through the surrounding code, I saw that: Lines 172 to 175 in 7b2c54b
still implements the remove_cvref_t<T> mentioned in https://eel.is/c++draft/format.arg#4 .
|
|
See also #2246 |
I believe that behavior is consistent with the wording in the working draft; we should accept |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
Thanks for handling this highly volatile issue! 🧪 🥼 😹 |
... for now, at least. This corrects a defect in our implementation of [format.args]/4's requirement that:
be a valid expression. We were incorrectly stripping cv-qualifiers from
T.