// { dg-do run { target c++20 } } // PR libstdc++/114240 sys_days not being parsed with only a date in the stream #include #include #include template void test_parse_date_only() { using namespace std::chrono; using CDays = time_point; CDays td; std::istringstream is("2024-03-05"); VERIFY( is >> parse("%Y-%m-%d ", td) ); if constexpr (std::is_same_v) VERIFY( td == static_cast>(2024y/March/5) ); else { auto tp = clock_cast(sys_days(2024y/March/5)); VERIFY( td == time_point_cast(tp) ); } } int main() { test_parse_date_only(); test_parse_date_only(); test_parse_date_only(); test_parse_date_only(); test_parse_date_only(); test_parse_date_only(); }