You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<chrono>
#include<format>
#include<iostream>intmain() {
// remove `+ 1` to get rid of an error (see https://godbolt.org/z/9WGMoWeeo)using R = std::ratio<128 + 64 + 8 + 1, std::numeric_limits<int>::max()>;
using D = std::chrono::duration<int, R>;
std::cout << std::format("{:%Q %q}\n", D{4});
}
Build:
PS D:\stl-playground> cl /std:c++20 /EHsc /nologo .\chronat.cppchronat.cppD:\stl\out\build\x64\out\inc\chrono(4949): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'std::chrono::hh_mm_ss<_Ty>' with [ _Ty=std::chrono::duration<int,R> ]D:\stl\out\build\x64\out\inc\chrono(4949): note: No constructor could take the source type, or constructor overload resolution was ambiguousD:\stl\out\build\x64\out\inc\chrono(5013): note: see reference to function template instantiation 'std::chrono::hh_mm_ss<_Ty> std::chrono::_Hh_mm_ss_part_underflow_to_zero<_Ty>(const _Duration &)' being compiled with [ _Ty=std::chrono::duration<int,R>, _Duration=std::chrono::duration<int,R> ]
# [...]
It seems that the return type of _Hh_mm_ss_part_underflow_to_zero is sometimes incorect. Perhaps we should use hh_mm_ss<common_type_t<_Duration, days>> (where common_type_t<_Duration, days> is the return type of _Remove_duration_part) as the return type.
Repro:
Build:
Compiler explorer: https://godbolt.org/z/o71s74c8K
The text was updated successfully, but these errors were encountered: