https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116755
--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Zartaj Majeed from comment #9) > Won't I have to separately add units to +d2.count()? No, I'm saying that the operator<< for duration should use +d.count() instead of d.count(), because that promotes signed char to int. > 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()); > | ~~~~~~~~~~~^~~~~ That was Bug 115668 and is already fixed. You're using a very outdated development snapshot: 14.0.1 20240412 Please upgrade your compiler.