-
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>
: Hideous compiler errors when formatter<UDT>::format()
isn't const
#4202
Comments
The associated constraints of |
With #4133 merged, now the message is much shorter
|
The remaining issue (without my mistake in and accidental fix) should only be about the It seems that we can reform template <class _Ty, class _Context, class _Formatter = _Context::template formatter_type<remove_const_t<_Ty>>>
concept _Formattable_with_non_const = semiregular<_Formatter>
&& requires(_Formatter& __f, _Ty&& __t, _Context __fc,
basic_format_parse_context<typename _Context::char_type> __pc) {
{ __f.parse(__pc) } -> same_as<typename decltype(__pc)::iterator>;
{ __f.format(__t, __fc) } -> same_as<typename _Context::iterator>;
};
template <class _Ty, class _Context, class _Formatter = _Context::template formatter_type<remove_const_t<_Ty>>>
concept _Formattable_with = _Formattable_with_non_const<_Ty, _Context, _Formatter>
&& requires(const _Formatter& __cf, _Ty&& __t, _Context __fc) {
{ __cf.format(__t, __fc) } -> same_as<typename _Context::iterator>;
}; And then split |
Consider this repro from DevCom-10515914 where a user-defined
formatter<UDT>
forgot to markformat()
asconst
. After #3745, we reject that as required by the Standard, but the compiler error is horrible:This issue exists to track the possibility of improving this diagnostic without distorting the library code too much (in a way that risks damaging correctness).
The text was updated successfully, but these errors were encountered: