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

--- Comment #9 from Zartaj Majeed <zmajeed at sbcglobal dot net> ---
Won't I have to separately add units to +d2.count()?

I didn't think to try unsigned types because I'm working with system_clock that
I believe requires signed Rep - but the following doesn't compile for me

auto d3 = duration_cast<duration<make_unsigned_t<int64_t>>>(d1);
println("d3 duration_cast unsigned value {}", d3);

test.cpp:14:10:   required from here
   14 |   println("d3 duration_cast unsigned value {}", d3);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/chrono_io.h:1610:44: error: no matching function for
call to ‘abs(const std::chrono::duration<long unsigned int>&)’
 1610 |           return _M_f._M_format(chrono::abs(__d), __fc, __d <
__d.zero());
      |                                 ~~~~~~~~~~~^~~~~

Reply via email to