-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
formatC++20 std::format or std::print, and anything related to themC++20 std::format or std::print, and anything related to themlibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Description
Testcase: https://godbolt.org/z/EM7WxfEfT
#include <chrono>
#include <format>
int main()
{
(void)
std::format("{}", std::chrono::duration<unsigned>{});
}
Does not build:
In file included from /opt/compiler-explorer/clang-trunk-20240626/bin/../include/c++/v1/chrono:952:
/opt/compiler-explorer/clang-trunk-20240626/bin/../include/c++/v1/__chrono/formatter.h:594:63: error: no matching function for call to 'abs'
594 | __formatter::__format_chrono_using_chrono_specs(__sstr, chrono::abs(__value), __chrono_specs);
| ^~~~~~~~~~~
chrono::abs is constrained for durations whose representation type is signed. This excludes unsigned types as well as any user-defined representation type.
Matching bug in libstdc++: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115668
Metadata
Metadata
Assignees
Labels
formatC++20 std::format or std::print, and anything related to themC++20 std::format or std::print, and anything related to themlibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.