https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109772

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I had a brain fart with this constraint for choosing the subseconds
representation:

        // True if the maximum constructor argument can be represented in _Tp.
        template<typename _Tp>
          static constexpr bool __fits
            = duration_values<typename _Duration::rep>::max()
                <= duration_values<_Tp>::max();

What matters is not the _Duration type, but the precision type. Given a
_Duration like duration<int64_t, ratio<1, 1024>> we can easily fit the maximum
fractional seconds value of 1023 in a 32-bit integer. But what we actually need
to store is not a count of 1023 [1/1024]s units, but 9990234375
[1/10000000000]s units. And 9990234375 doesn't fit in 32 bits.

Reply via email to