-
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
Check make_format_args
's preconditions
#3080
Conversation
I'm scared that this is going to blow up because we got the nuances of the type mapping machinery confused again, somehow. I'm worried about types where formatability depends on cvref qualifiers |
I couldn't come up with any cases where this error does not agree with the later concept failure, and this actually is an error improvement. |
Co-authored-by: Sam Huang <[email protected]>
I've added Standardese citations as recommended by @sam20908 (thanks!). Note that the same paragraph is cited for narrow and wide because of Effects Equivalent To wording. ✅ No modules impact. |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for this diagnostic improvement! 🎉 💡 😸 |
[format.arg.store]
Currently, this precondition isn't checked. If an user passes an unformattable type, the error message will likely start with "'std::_Format_arg_traits<_Context>::_Phony_basic_format_arg_constructor': none of the 5 overloads could convert all the argument types", which isn't quite helpful.
Before LWG-3701, It was impractical to check this precondition, because even
std::format("Hello {}!\n", "world")
was a precondition violation. This is no longer a concern after LWG-3701 lands.The error message was copied from fmtlib (https://github.com/fmtlib/fmt/blob/1feb430faaac6bd8094e996861d6025f9903d34e/include/fmt/core.h#L1771-L1772).