[PATCH] libstdc++: Fix format call and test formatting with empty specs for durations.
Tomasz Kaminski
tkaminsk@redhat.com
Wed Jun 4 11:09:06 GMT 2025
On Wed, Jun 4, 2025 at 1:06 PM Daniel Krügler <daniel.kruegler@gmail.com>
wrote:
> Am Mi., 4. Juni 2025 um 12:57 Uhr schrieb Tomasz Kaminski <
> tkaminsk@redhat.com>:
>
>>
>>
>> On Wed, Jun 4, 2025 at 12:43 PM Daniel Krügler <daniel.kruegler@gmail.com>
>> wrote:
>>
>>> Am Mi., 4. Juni 2025 um 11:27 Uhr schrieb Tomasz Kamiński <
>>> tkaminsk@redhat.com>:
>>>
>>>> [...]
>>>> +
>>>> +template<typename Ret, typename Other>
>>>> + requires std::is_integral_v<Other>
>>>> +struct std::common_type<Rep<Ret>, Other>
>>>> +{
>>>> + using type = Rep<Ret>;
>>>> +};
>>>> +
>>>> +template<typename Ret, typename Other>
>>>> + requires std::is_integral_v<Other>
>>>> +struct std::common_type<Other, Rep<Ret>>
>>>> + : std::common_type<Rep<Ret>, Other>
>>>> +{ };
>>>>
>>>
>>> Why is this second specialization needed? It seems to me
>>> that [meta.trans.other] p5 says that it is already provided by the library
>>> implementation of std::common_type.
>>>
>> My reading of the paragraph is different. It says that if one is
>> specialized, we also need to specialize the other:
>> > Moreover, common_type_t<T1, T2> shall denote the same type, if any, as
>> does common_type_t<T2, T1>.
>> <https://eel.is/c++draft/meta.trans.other#5.sentence-4>
>> > No diagnostic is required for a violation of this Note's rules.
>> <https://eel.is/c++draft/meta.trans.other#5.sentence-5>
>> "shall" are requirements on the users.
>>
>
> Yes you are right, sorry for the noise.
>
FWIW, I initially wrote the test with only one of these specializations, as
you suggested.
Adding the second one was driven by compiler errors.
>
> - Daniel
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20250604/7e93533a/attachment.htm>
More information about the Libstdc++
mailing list