diff --git a/libcxx/include/__chrono/convert_to_tm.h b/libcxx/include/__chrono/convert_to_tm.h --- a/libcxx/include/__chrono/convert_to_tm.h +++ b/libcxx/include/__chrono/convert_to_tm.h @@ -11,9 +11,7 @@ #define _LIBCPP___CHRONO_CONVERT_TO_TM_H #include <__chrono/day.h> -#include <__concepts/same_as.h> #include <__config> -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -23,18 +21,14 @@ #if _LIBCPP_STD_VER > 17 -template -_LIBCPP_HIDE_FROM_ABI tm __convert_to_tm(const _Tp& __value) { - tm __result = {}; +// Convert chrono::days to the given tm type, which must have the same properties as std::tm. +template +_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const chrono::day& __value) { + _Tm __result = {}; # ifdef __GLIBC__ __result.tm_zone = "UTC"; # endif - - if constexpr (same_as<_Tp, chrono::day>) - __result.tm_mday = static_cast(__value); - else - static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); - + __result.tm_mday = static_cast(__value); return __result; } diff --git a/libcxx/include/__chrono/formatter.h b/libcxx/include/__chrono/formatter.h --- a/libcxx/include/__chrono/formatter.h +++ b/libcxx/include/__chrono/formatter.h @@ -55,7 +55,7 @@ template _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs( const _Tp& __value, basic_stringstream<_CharT>& __sstr, basic_string_view<_CharT> __chrono_specs) { - tm __t = std::__convert_to_tm(__value); + tm __t = std::__convert_to_tm(__value); const auto& __facet = std::use_facet>(__sstr.getloc()); for (auto __it = __chrono_specs.begin(); __it != __chrono_specs.end(); ++__it) { if (*__it == _CharT('%')) { diff --git a/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-has-no-localization +// UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format // TODO FMT Investigate Windows issues. diff --git a/libcxx/test/std/time/time.syn/formatter.day.pass.cpp b/libcxx/test/std/time/time.syn/formatter.day.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.day.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.day.pass.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-has-no-localization +// UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format // TODO FMT Investigate Windows issues.