public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/redi/heads/calendar)] Ed's work on calendar types
@ 2020-08-11 14:17 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-08-11 14:17 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:6cbad90580ccf4a83ecd73befc42c29dc880ec89

commit 6cbad90580ccf4a83ecd73befc42c29dc880ec89
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jun 2 18:15:25 2020 +0100

    Ed's work on calendar types
    
    libstdc++-v3/ChangeLog:
    
            * include/std/chrono:
            * testsuite/20_util/day/1.cc: New test.
            * testsuite/20_util/month/1.cc: New test.
            * testsuite/20_util/month_day/1.cc: New test.
            * testsuite/20_util/month_day/operations.cc: New test.
            * testsuite/20_util/month_day_last/1.cc: New test.
            * testsuite/20_util/month_day_last/operations.cc: New test.
            * testsuite/20_util/month_weekday/1.cc: New test.
            * testsuite/20_util/month_weekday/operations.cc: New test.
            * testsuite/20_util/month_weekday_last/1.cc: New test.
            * testsuite/20_util/month_weekday_last/operations.cc: New test.
            * testsuite/20_util/weekday/1.cc: New test.
            * testsuite/20_util/weekday_indexed/1.cc: New test.
            * testsuite/20_util/weekday_last/1.cc: New test.
            * testsuite/20_util/year/1.cc: New test.
            * testsuite/20_util/year_month/1.cc: New test.
            * testsuite/20_util/year_month/operations.cc: New test.
            * testsuite/20_util/year_month_day/1.cc: New test.
            * testsuite/20_util/year_month_day/operations.cc: New test.
            * testsuite/20_util/year_month_day_last/1.cc: New test.
            * testsuite/20_util/year_month_day_last/operations.cc: New test.
            * testsuite/20_util/year_month_weekday/1.cc: New test.
            * testsuite/20_util/year_month_weekday/operations.cc: New test.
            * testsuite/20_util/year_month_weekday_last/1.cc: New test.
            * testsuite/20_util/year_month_weekday_last/operations.cc: New test.

Diff:
---
 libstdc++-v3/include/std/chrono                    | 2545 +++++++++++++++++++-
 libstdc++-v3/testsuite/20_util/day/1.cc            |   56 +
 libstdc++-v3/testsuite/20_util/month/1.cc          |   59 +
 libstdc++-v3/testsuite/20_util/month_day/1.cc      |   67 +
 .../testsuite/20_util/month_day/operations.cc      |   36 +
 libstdc++-v3/testsuite/20_util/month_day_last/1.cc |   53 +
 .../testsuite/20_util/month_day_last/operations.cc |   36 +
 libstdc++-v3/testsuite/20_util/month_weekday/1.cc  |   35 +
 .../testsuite/20_util/month_weekday/operations.cc  |   36 +
 .../testsuite/20_util/month_weekday_last/1.cc      |   36 +
 .../20_util/month_weekday_last/operations.cc       |   36 +
 libstdc++-v3/testsuite/20_util/weekday/1.cc        |   78 +
 .../testsuite/20_util/weekday_indexed/1.cc         |   51 +
 libstdc++-v3/testsuite/20_util/weekday_last/1.cc   |   48 +
 libstdc++-v3/testsuite/20_util/year/1.cc           |   74 +
 libstdc++-v3/testsuite/20_util/year_month/1.cc     |   52 +
 .../testsuite/20_util/year_month/operations.cc     |   34 +
 libstdc++-v3/testsuite/20_util/year_month_day/1.cc |   49 +
 .../testsuite/20_util/year_month_day/operations.cc |   37 +
 .../testsuite/20_util/year_month_day_last/1.cc     |   48 +
 .../20_util/year_month_day_last/operations.cc      |   38 +
 .../testsuite/20_util/year_month_weekday/1.cc      |   53 +
 .../20_util/year_month_weekday/operations.cc       |   37 +
 .../testsuite/20_util/year_month_weekday_last/1.cc |   45 +
 .../20_util/year_month_weekday_last/operations.cc  |   37 +
 25 files changed, 3579 insertions(+), 97 deletions(-)

diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 6d78f32ac78..e9f140ccab4 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -246,6 +246,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif // C++17
 
 #if __cplusplus > 201703L
+
+  namespace __detail
+  {
+    template<typename _Int>
+      constexpr _Int
+      __modulo(_Int __num, _Int __den)
+      { return /*FIXME?*/__num % __den; }
+
+    constexpr int
+    __days_per_month[12]
+    { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+    constexpr int
+    __last_day[12]
+    { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+  }
+
     template<typename _Tp>
       struct is_clock;
 
@@ -753,6 +769,198 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     /// months
     using months	= duration<_GLIBCXX_CHRONO_INT64_T, ratio<2629746>>;
+
+    // CLASS DECLARATIONS
+    class day;
+    class month;
+    class year;
+    class weekday;
+    class weekday_indexed;
+    class weekday_last;
+    class month_day;
+    class month_day_last;
+    class month_weekday;
+    class month_weekday_last;
+    class year_month;
+    class year_month_day;
+    class year_month_day_last;
+    class year_month_weekday;
+    class year_month_weekday_last;
+    class nonexistent_local_time;
+    class ambiguous_local_time;
+    class time_zone;
+    class tzdb;
+    class tzdb_list;
+    class leap;
+    class link;
+
+    struct last_spec
+    {
+      explicit last_spec() = default;
+    };
+
+    inline constexpr last_spec last{};
+
+    const tzdb& get_tzdb();
+    tzdb_list& get_tzdb_list();
+
+    // CALENDAR COMPOSITION OPERATORS
+
+    constexpr year_month
+    operator/(const year& __y, const month& __m) noexcept;
+
+    constexpr year_month
+    operator/(const year& __y, int __m) noexcept;
+
+    constexpr month_day
+    operator/(const month& __m, const day& __d) noexcept;
+
+    constexpr month_day
+    operator/(const month& __m, int __d) noexcept;
+
+    constexpr month_day
+    operator/(int __m, const day& __d) noexcept;
+
+    constexpr month_day
+    operator/(const day& __d, const month& __m) noexcept;
+
+    constexpr month_day
+    operator/(const day& __d, int __m) noexcept;
+
+    constexpr month_day_last
+    operator/(const month& __m, last_spec) noexcept;
+
+    constexpr month_day_last
+    operator/(int __m, last_spec) noexcept;
+
+    constexpr month_day_last
+    operator/(last_spec, const month& __m) noexcept;
+
+    constexpr month_day_last
+    operator/(last_spec, int __m) noexcept;
+
+    constexpr month_weekday
+    operator/(const month& __m, const weekday_indexed& __wdi) noexcept;
+
+    constexpr month_weekday
+    operator/(int __m, const weekday_indexed& __wdi) noexcept;
+
+    constexpr month_weekday
+    operator/(const weekday_indexed& __wdi, const month& __m) noexcept;
+
+    constexpr month_weekday
+    operator/(const weekday_indexed& __wdi, int __m) noexcept;
+
+    constexpr month_weekday_last
+    operator/(const month& __m, const weekday_last& __wdl) noexcept;
+
+    constexpr month_weekday_last
+    operator/(int __m, const weekday_last& __wdl) noexcept;
+
+    constexpr month_weekday_last
+    operator/(const weekday_last& __wdl, const month& __m) noexcept;
+
+    constexpr month_weekday_last
+    operator/(const weekday_last& __wdl, int __m) noexcept;
+
+    constexpr year_month_day
+    operator/(const year_month& __ym, const day& __d) noexcept;
+
+    constexpr year_month_day
+    operator/(const year_month& __ym, int __d) noexcept;
+
+    constexpr year_month_day
+    operator/(const year& __y, const month_day& __md) noexcept;
+
+    constexpr year_month_day
+    operator/(int __y, const month_day& __md) noexcept;
+
+    constexpr year_month_day
+    operator/(const month_day& __md, const year& __y) noexcept;
+
+    constexpr year_month_day
+    operator/(const month_day& __md, int __y) noexcept;
+
+    constexpr year_month_day_last
+    operator/(const year_month& __ym, last_spec) noexcept;
+
+    constexpr year_month_day_last
+    operator/(const year& __y, const month_day_last& __mdl) noexcept;
+
+    constexpr year_month_day_last
+    operator/(int __y, const month_day_last& __mdl) noexcept;
+
+    constexpr year_month_day_last
+    operator/(const month_day_last& __mdl, const year& __y) noexcept;
+
+    constexpr year_month_day_last
+    operator/(const month_day_last& __mdl, int __y) noexcept;
+
+    constexpr year_month_weekday
+    operator/(const year_month& __ym, const weekday_indexed& __wdi) noexcept;
+
+    constexpr year_month_weekday
+    operator/(const year& __y, const month_weekday& __mwd) noexcept;
+
+    constexpr year_month_weekday
+    operator/(int __y, const month_weekday& __mwd) noexcept;
+
+    constexpr year_month_weekday
+    operator/(const month_weekday& __mwd, const year& __y) noexcept;
+
+    constexpr year_month_weekday
+    operator/(const month_weekday& __mwd, int __y) noexcept;
+
+    constexpr year_month_weekday_last
+    operator/(const year_month& __ym, const weekday_last& __wdl) noexcept;
+
+    constexpr year_month_weekday_last
+    operator/(const year& __y, const month_weekday_last& __mwdl) noexcept;
+
+    constexpr year_month_weekday_last
+    operator/(int __y, const month_weekday_last& __mwdl) noexcept;
+
+    constexpr year_month_weekday_last
+    operator/(const month_weekday_last& __mwdl, const year& __y) noexcept;
+
+    constexpr year_month_weekday_last
+    operator/(const month_weekday_last& __mwdl, int __y) noexcept;
+
+    // OTHER CALENDAR OPERATORS
+
+    constexpr year_month_day_last
+    operator+(const year_month_day_last& __ymdl, const months& __dm) noexcept;
+
+    constexpr year_month_day_last
+    operator-(const year_month_day_last& __ymdl, const months& __dm) noexcept;
+
+    constexpr year_month_day_last
+    operator+(const year_month_day_last& __ymdl, const years& __y) noexcept;
+
+    constexpr year_month_day_last
+    operator-(const year_month_day_last& __ymdl, const years& __y) noexcept;
+
+    constexpr year_month_weekday_last
+    operator+(const year_month_weekday_last& __ymwdl,
+	      const months& __dm) noexcept;
+    constexpr year_month_weekday_last
+    operator+(const months& __dm,
+	      const year_month_weekday_last& __ymwdl) noexcept;
+    constexpr year_month_weekday_last
+    operator+(const year_month_weekday_last& __ymwdl,
+	      const years& __dy) noexcept;
+    constexpr year_month_weekday_last
+    operator+(const years& __dy,
+	      const year_month_weekday_last& __ymwdl) noexcept;
+    constexpr year_month_weekday_last
+    operator-(const year_month_weekday_last& __ymwdl,
+	      const months& __dm) noexcept;
+    constexpr year_month_weekday_last
+    operator-(const year_month_weekday_last& __ymwdl,
+	      const years& __dy) noexcept;
+
+    constexpr weekday operator+(const weekday& __x, const days& __y) noexcept;
+    constexpr weekday operator-(const weekday& __x, const days& __y) noexcept;
 #endif // C++20
 
 #undef _GLIBCXX_CHRONO_INT64_T
@@ -1075,121 +1283,2264 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using local_time = time_point<local_t, _Duration>;
     using local_seconds = local_time<seconds>;
     using local_days = local_time<days>;
-#endif // C++20
 
-    // @}
-  } // namespace chrono
+    /**
+     *  @brief Universal coordinated time clock
+     *
+     *  @ingroup chrono
+    */
+    class utc_clock
+    {
+    public:
 
-#if __cplusplus > 201103L
+      using duration = system_clock::duration;
+      using rep = duration::rep;
+      using period = duration::period;
+      using time_point = chrono::time_point<utc_clock>;
+      static constexpr bool is_steady = false;
 
-#define __cpp_lib_chrono_udls 201304
+      static time_point now()
+      { return from_sys(std::chrono::system_clock::now()); }
 
-  inline namespace literals
-  {
-  /** ISO C++ 2014  namespace for suffixes for duration literals.
-   *
-   * These suffixes can be used to create `chrono::duration` values with
-   * tick periods of hours, minutes, seconds, milliseconds, microseconds
-   * or nanoseconds. For example, `std::chrono::seconds(5)` can be written
-   * as `5s` after making the suffix visible in the current scope.
-   * The suffixes can be made visible by a using-directive or
-   * using-declaration such as:
-   *  - `using namespace std::chrono_literals;`
-   *  - `using namespace std::literals;`
-   *  - `using namespace std::chrono;`
-   *  - `using namespace std;`
-   *  - `using std::chrono_literals::operator""s;`
-   *
-   * The result of these suffixes on an integer literal is one of the
-   * standard typedefs such as `std::chrono::hours`.
-   * The result on a floating-point literal is a duration type with the
-   * specified tick period and an unspecified floating-point representation,
-   * for example `1.5e2ms` might be equivalent to
-   * `chrono::duration<long double, chrono::milli>(1.5e2)`.
-   *
-   * @ingroup chrono
-   */
-  inline namespace chrono_literals
-  {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wliteral-suffix"
-    /// @cond undocumented
-    template<typename _Dur, char... _Digits>
-      constexpr _Dur __check_overflow()
+      template<typename _Duration>
+        static chrono::time_point<system_clock, common_type_t<_Duration, seconds>>
+        to_sys(const chrono::time_point<utc_clock, _Duration>&);
+
+      template<typename _Duration>
+        static chrono::time_point<utc_clock, common_type_t<_Duration, seconds>>
+        from_sys(const chrono::time_point<system_clock, _Duration>&);
+    };
+
+    template<typename _Duration>
+      using utc_time = time_point<utc_clock, _Duration>;
+    using utc_seconds = utc_time<seconds>;
+
+    /**
+     *  @brief International Atomic Time (TAI) clock
+     *
+     *  @ingroup chrono
+    */
+    class tai_clock
+    {
+    public:
+
+      using duration = system_clock::duration;
+      using rep = duration::rep;
+      using period = duration::period;
+      using time_point = chrono::time_point<tai_clock>;
+      static constexpr bool is_steady = false;
+
+      static time_point
+      now()
+      { return from_utc(utc_clock::now()); };
+
+      template<typename _Duration>
+        static chrono::time_point<utc_clock, common_type_t<_Duration, seconds>>
+        to_utc(const chrono::time_point<tai_clock, _Duration>&) noexcept;
+
+      template<typename _Duration>
+        static chrono::time_point<tai_clock, common_type_t<_Duration, seconds>>
+        from_utc(const chrono::time_point<utc_clock, _Duration>&) noexcept;
+    };
+
+    template<typename _Duration>
+      using tai_time = time_point<tai_clock, _Duration>;
+    using tai_seconds = tai_time<seconds>;
+
+    /**
+     *  @brief Global Positioning System (GPS) clock
+     *
+     *  @ingroup chrono
+    */
+    class gps_clock
+    {
+    public:
+
+      using duration = system_clock::duration;
+      using rep = duration::rep;
+      using period = duration::period;
+      using time_point = chrono::time_point<gps_clock>;
+      static constexpr bool is_steady = false;
+
+      static time_point
+      now();
+
+      template<typename _Duration>
+        static chrono::time_point<utc_clock, common_type_t<_Duration, seconds>>
+        to_utc(const chrono::time_point<gps_clock, _Duration>&) noexcept;
+
+      template<typename _Duration>
+        static chrono::time_point<gps_clock, common_type_t<_Duration, seconds>>
+        from_utc(const chrono::time_point<utc_clock, _Duration>&) noexcept;
+    };
+
+    template<typename _Duration>
+      using gps_time = time_point<gps_clock, _Duration>;
+    using gps_seconds = gps_time<seconds>;
+
+    // TIME_POINT CONVERSIONS
+
+    template<typename _DestClock, typename _SourceClock>
+      struct clock_time_conversion;
+
+    //template<typename _DestClock, typename _SourceClock, typename _Duration>
+    //  time_point<_DestClock, see below>
+    //  clock_cast(const time_point<_SourceClock, _Duration>& __t);
+
+    // Identity
+    template<typename _Clock>
+      struct clock_time_conversion<_Clock, _Clock>
       {
-	using _Val = __parse_int::_Parse_int<_Digits...>;
-	constexpr typename _Dur::rep __repval = _Val::value;
-	static_assert(__repval >= 0 && __repval == _Val::value,
-		      "literal value cannot be represented by duration type");
-	return _Dur(__repval);
+        template<typename _Duration>
+	  time_point<_Clock, _Duration>
+	  operator()(const time_point<_Clock, _Duration>& __t) const
+	  { return __t; }
+      };
+
+    template<>
+      struct clock_time_conversion<system_clock, system_clock>
+      {
+        template<typename _Duration>
+	  sys_time<_Duration>
+	  operator()(const sys_time<_Duration>& __t) const
+	  { return __t; }
+      };
+
+    template<>
+      struct clock_time_conversion<utc_clock, utc_clock>
+      {
+        template<typename _Duration>
+	  utc_time<_Duration>
+	  operator()(const utc_time<_Duration>& __t) const
+	  { return __t; }
+      };
+
+    // system_clock <-> utc_clock
+    template<>
+      struct clock_time_conversion<utc_clock, system_clock>
+      {
+        template<typename _Duration>
+	  utc_time<common_type_t<_Duration, seconds>>
+	  operator()(const sys_time<_Duration>& __t) const
+	  { return utc_clock::from_sys(__t); }
+      };
+
+    template<>
+      struct clock_time_conversion<system_clock, utc_clock>
+      {
+        template<typename _Duration>
+	  sys_time<common_type_t<_Duration, seconds>>
+	  operator()(const utc_time<_Duration>& __t) const
+	  { return utc_clock::to_sys(__t); }
+      };
+
+    // Clock <-> system_clock
+    template<typename _SourceClock>
+      struct clock_time_conversion<system_clock, _SourceClock>
+      {
+        template<typename _Duration>
+	  auto
+	  operator()(const time_point<_SourceClock, _Duration>& __t) const
+	  -> decltype(_SourceClock::to_sys(__t))
+	  { return _SourceClock::to_sys(__t); }
+      };
+
+
+    template<typename _DestClock>
+      struct clock_time_conversion<_DestClock, system_clock>
+      {
+        template<typename _Duration>
+	  auto
+	  operator()(const sys_time<_Duration>& __t) const
+	  -> decltype(_DestClock::from_sys(__t))
+	  { return _DestClock::from_sys(__t); }
+      };
+
+    // Clock <-> utc_clock
+    template<typename _SourceClock>
+      struct clock_time_conversion<utc_clock, _SourceClock>
+      {
+        template<typename _Duration>
+	  auto
+	  operator()(const time_point<_SourceClock, _Duration>& __t) const
+	  -> decltype(_SourceClock::to_utc(__t))
+	  { return _SourceClock::to_utc(__t); }
+     };
+
+    template<typename _DestClock>
+      struct clock_time_conversion<_DestClock, utc_clock>
+      {
+        template<typename _Duration>
+	  auto
+	  operator()(const utc_time<_Duration>& __t) const
+	  -> decltype(_DestClock::from_utc(__t))
+	  { return _DestClock::from_utc(__t); }
+      };
+
+    // CALENDRICAL TYPES
+
+    struct last_spec;
+
+    // DAY
+
+    class day
+    {
+    private:
+
+      unsigned char _M_d;
+
+    public:
+
+      day() = default;
+
+      explicit constexpr day(unsigned __d) noexcept
+      : _M_d(__d)
+      { }
+
+      constexpr day&
+      operator++() noexcept
+      {
+        ++this->_M_d;
+        return *this;
       }
-    /// @endcond
 
-    /// Literal suffix for durations representing non-integer hours
-    constexpr chrono::duration<long double, ratio<3600,1>>
-    operator""h(long double __hours)
-    { return chrono::duration<long double, ratio<3600,1>>{__hours}; }
+      constexpr day
+      operator++(int) noexcept
+      {
+        auto ret(*this);
+        ++this->_M_d;
+        return ret;
+      }
 
-    /// Literal suffix for durations of type `std::chrono::hours`
-    template <char... _Digits>
-      constexpr chrono::hours
-      operator""h()
-      { return __check_overflow<chrono::hours, _Digits...>(); }
+      constexpr day&
+      operator--() noexcept
+      {
+        --this->_M_d;
+        return *this;
+      }
 
-    /// Literal suffix for durations representing non-integer minutes
-    constexpr chrono::duration<long double, ratio<60,1>>
-    operator""min(long double __mins)
-    { return chrono::duration<long double, ratio<60,1>>{__mins}; }
+      constexpr day
+      operator--(int) noexcept
+      {
+        auto ret(*this);
+        --this->_M_d;
+        return ret;
+      }
 
-    /// Literal suffix for durations of type `std::chrono::minutes`
-    template <char... _Digits>
-      constexpr chrono::minutes
-      operator""min()
-      { return __check_overflow<chrono::minutes, _Digits...>(); }
+      constexpr day&
+      operator+=(const days& __d) noexcept
+      {
+        this->_M_d += __d.count();
+        return *this;
+      }
 
-    /// Literal suffix for durations representing non-integer seconds
-    constexpr chrono::duration<long double>
-    operator""s(long double __secs)
-    { return chrono::duration<long double>{__secs}; }
+      constexpr day&
+      operator-=(const days& __d) noexcept
+      {
+        this->_M_d -= __d.count();
+        return *this;
+      }
 
-    /// Literal suffix for durations of type `std::chrono::seconds`
-    template <char... _Digits>
-      constexpr chrono::seconds
-      operator""s()
-      { return __check_overflow<chrono::seconds, _Digits...>(); }
+      constexpr explicit
+      operator unsigned() const noexcept
+      { return this->_M_d; }
 
-    /// Literal suffix for durations representing non-integer milliseconds
-    constexpr chrono::duration<long double, milli>
-    operator""ms(long double __msecs)
-    { return chrono::duration<long double, milli>{__msecs}; }
+      constexpr bool
+      ok() const noexcept
+      { return 1 <= this->_M_d && this->_M_d <= 31; }
+    };
 
-    /// Literal suffix for durations of type `std::chrono::milliseconds`
-    template <char... _Digits>
-      constexpr chrono::milliseconds
-      operator""ms()
-      { return __check_overflow<chrono::milliseconds, _Digits...>(); }
+    constexpr bool
+    operator==(const day& __x, const day& __y) noexcept
+    { return unsigned{__x} == unsigned{__y}; }
+
+    constexpr bool
+    operator!=(const day& __x, const day& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr bool
+    operator<(const day& __x, const day& __y) noexcept
+    { return unsigned{__x} < unsigned{__y}; }
+
+    constexpr bool
+    operator>(const day& __x, const day& __y) noexcept
+    { return __y < __x; }
+
+    constexpr bool
+    operator<=(const day& __x, const day& __y) noexcept
+    { return !(__y < __x); }
+
+    constexpr bool
+    operator>=(const day& __x, const day& __y) noexcept
+    { return !(__x < __y); }
+
+    constexpr day
+    operator+(const day& __x, const days& __y) noexcept
+    { return day(unsigned{__x} + __y.count()); }
+
+    constexpr day
+    operator+(const days& __x, const day& __y) noexcept
+    { return __y + __x; }
+
+    constexpr day
+    operator-(const day& __x, const days& __y) noexcept
+    { return __x + -__y; }
+
+    constexpr days
+    operator-(const day& __x, const day& __y) noexcept
+    { return days{int(unsigned{__x}) - int(unsigned{__y})}; }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os, const day& __d);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      to_stream(std::basic_ostream<_CharT, _Traits>& __os,
+	        const _CharT* __fmt, const day& __d);
+
+    template<typename _CharT, typename _Traits,
+	     typename _Alloc = allocator<_CharT>>
+      std::basic_istream<_CharT, _Traits>&
+      from_stream(std::basic_istream<_CharT, _Traits>& __is, const _CharT* __fmt,
+		  day& __d,
+		  std::basic_string<_CharT, _Traits, _Alloc>* __abbrev = nullptr,
+		  minutes* __offset = nullptr);
+*/
+    // MONTH
+
+    class month
+    {
+    private:
 
-    /// Literal suffix for durations representing non-integer microseconds
-    constexpr chrono::duration<long double, micro>
-    operator""us(long double __usecs)
-    { return chrono::duration<long double, micro>{__usecs}; }
+      unsigned char _M_m;
 
-    /// Literal suffix for durations of type `std::chrono::microseconds`
-    template <char... _Digits>
-      constexpr chrono::microseconds
-      operator""us()
-      { return __check_overflow<chrono::microseconds, _Digits...>(); }
+    public:
 
-    /// Literal suffix for durations representing non-integer nanoseconds
-    constexpr chrono::duration<long double, nano>
-    operator""ns(long double __nsecs)
-    { return chrono::duration<long double, nano>{__nsecs}; }
+      month() = default;
 
-    /// Literal suffix for durations of type `std::chrono::nanoseconds`
-    template <char... _Digits>
-      constexpr chrono::nanoseconds
-      operator""ns()
-      { return __check_overflow<chrono::nanoseconds, _Digits...>(); }
+      explicit constexpr
+      month(unsigned __m) noexcept
+      : _M_m(__m)
+      { }
+
+      constexpr month&
+      operator++() noexcept
+      {
+        ++this->_M_m;
+        return *this;
+      }
+
+      constexpr month
+      operator++(int) noexcept
+      {
+        auto ret(*this);
+        ++this->_M_m;
+        return ret;
+      }
+
+      constexpr month&
+      operator--() noexcept
+      {
+        --this->_M_m;
+        return *this;
+      }
+
+      constexpr month
+      operator--(int) noexcept
+      {
+        auto ret(*this);
+        --this->_M_m;
+        return ret;
+      }
+
+      constexpr month&
+      operator+=(const months& __m) noexcept
+      {
+        this->_M_m += __m.count();
+        return *this;
+      }
+
+      constexpr month&
+      operator-=(const months& __m) noexcept
+      {
+        this->_M_m -= __m.count();
+        return *this;
+      }
+
+      explicit constexpr
+      operator unsigned() const noexcept
+      { return this->_M_m; }
+
+      constexpr bool
+      ok() const noexcept
+      { return 1 <= this->_M_m && this->_M_m <= 12; }
+    };
+
+    inline constexpr chrono::month January{1};
+    inline constexpr chrono::month February{2};
+    inline constexpr chrono::month March{3};
+    inline constexpr chrono::month April{4};
+    inline constexpr chrono::month May{5};
+    inline constexpr chrono::month June{6};
+    inline constexpr chrono::month July{7};
+    inline constexpr chrono::month August{8};
+    inline constexpr chrono::month September{9};
+    inline constexpr chrono::month October{10};
+    inline constexpr chrono::month November{11};
+    inline constexpr chrono::month December{12};
+
+    constexpr bool
+    operator==(const month& __x, const month& __y) noexcept
+    { return unsigned{__x} == unsigned{__y}; }
+
+    constexpr bool
+    operator!=(const month& __x, const month& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr bool
+    operator<(const month& __x, const month& __y) noexcept
+    { return unsigned{__x} < unsigned{__y}; }
+
+    constexpr bool
+    operator>(const month& __x, const month& __y) noexcept
+    { return __y < __x; }
+
+    constexpr bool
+    operator<=(const month& __x, const month& __y) noexcept
+    { return !(__y < __x); }
+
+    constexpr bool
+    operator>=(const month& __x, const month& __y) noexcept
+    { return !(__x < __y); }
+
+    constexpr month
+    operator+(const month& __x, const months& __y) noexcept
+    { return month(__detail::__modulo<unsigned char>(
+			  static_cast<long long>(unsigned{__x})
+	 	  + (__y.count() - 1), 12) + 1); }
+
+    constexpr month
+    operator+(const months& __x,  const month& __y) noexcept
+    { return __y + __x; }
+
+    constexpr month
+    operator-(const month& __x, const months& __y) noexcept
+    { return __x + -__y; }
+
+    constexpr months
+    operator-(const month& __x,  const month& __y) noexcept
+    {
+      const auto __dm = int(unsigned(__x)) - int(unsigned(__y));
+      return months{__dm < 0 ? 12 + __dm : __dm};
+    }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os, const month& __m);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      to_stream(std::basic_ostream<_CharT, _Traits>& __os,
+	        const _CharT* __fmt, const month& __m);
+
+    template<typename _CharT, typename _Traits,
+	     typename _Alloc = allocator<_CharT>>
+      std::basic_istream<_CharT, _Traits>&
+      from_stream(std::basic_istream<_CharT, _Traits>& __is, const _CharT* __fmt,
+		  month& __m,
+		  std::basic_string<_CharT, _Traits, _Alloc>* __abbrev = nullptr,
+		  minutes* __offset = nullptr);
+*/
+    // YEAR
+
+    class year
+    {
+      short _M_y;
+
+    public:
+
+      year() = default;
+
+      explicit constexpr
+      year(int __y) noexcept
+      : _M_y{static_cast<short>(__y)}
+      { }
+
+      static constexpr year
+      min() noexcept
+      { return year{-32767}; }
+
+      static constexpr year
+      max() noexcept
+      { return year{32767}; }
+
+      constexpr year&
+      operator++() noexcept
+      {
+        ++this->_M_y;
+        return *this;
+      }
+
+      constexpr year
+      operator++(int) noexcept
+      {
+        auto ret(*this);
+        ++this->_M_y;
+        return ret;
+      }
+
+      constexpr year&
+      operator--() noexcept
+      {
+        --this->_M_y;
+        return *this;
+      }
+
+      constexpr year
+      operator--(int) noexcept
+      {
+        auto ret(*this);
+        --this->_M_y;
+        return ret;
+      }
+
+      constexpr year&
+      operator+=(const years& __y) noexcept
+      {
+        this->_M_y += __y.count();
+        return *this;
+      }
+
+      constexpr year&
+      operator-=(const years& __y) noexcept
+      {
+        this->_M_y -= __y.count();
+        return *this;
+      }
+
+      constexpr year
+      operator+() const noexcept
+      { return *this; }
+
+      constexpr year
+      operator-() const noexcept
+      { return year(-this->_M_y); }
+
+      constexpr bool
+      is_leap() const noexcept
+      {
+        return this->_M_y % 4 == 0
+	    && (this->_M_y % 100 != 0 || this->_M_y % 400 == 0);
+      }
+
+      explicit constexpr
+      operator int() const noexcept
+      { return this->_M_y; }
+
+      constexpr bool
+      ok() const noexcept
+      { return int(year::min()) <= this->_M_y && this->_M_y <= int(year::max()); }
+    };
+
+    constexpr bool
+    operator==(const year& __x, const year& __y) noexcept
+    { return int{__x} == int{__y}; }
+
+    constexpr bool
+    operator!=(const year& __x, const year& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr bool
+    operator<(const year& __x, const year& __y) noexcept
+    { return int{__x} < int{__y}; }
+
+    constexpr bool
+    operator>(const year& __x, const year& __y) noexcept
+    { return __y < __x; }
+
+    constexpr bool
+    operator<=(const year& __x, const year& __y) noexcept
+    { return !(__y < __x); }
+
+    constexpr bool
+    operator>=(const year& __x, const year& __y) noexcept
+    { return !(__x < __y); }
+
+    constexpr year
+    operator+(const year& __x, const years& __y) noexcept
+    { return year{static_cast<int>(__x) + __y.count()}; }
+
+    constexpr year
+    operator+(const years& __x, const year& __y) noexcept
+    { return __y + __x; }
+
+    constexpr year
+    operator-(const year& __x, const years& __y) noexcept
+    { return year{static_cast<int>(__x) - __y.count()}; }
+
+    constexpr years
+    operator-(const year& __x, const year& __y) noexcept
+    { return years{static_cast<int>(__x) - static_cast<int>(__y)}; }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os, const year& __y);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      to_stream(std::basic_ostream<_CharT, _Traits>& __os,
+	        const _CharT* __fmt, const year& __y);
+
+    template<typename _CharT, typename _Traits,
+	     typename _Alloc = allocator<_CharT>>
+      std::basic_istream<_CharT, _Traits>&
+      from_stream(std::basic_istream<_CharT, _Traits>& __is, const _CharT* __fmt,
+		  year& __y,
+		  std::basic_string<_CharT, _Traits, _Alloc>* __abbrev = nullptr,
+		  minutes* __offset = nullptr);
+*/
+    // WEEKDAY
+
+    class weekday
+    {
+    private:
+
+      unsigned char _M_wd;
+
+      constexpr static unsigned char
+      _S_from_days(int __d) noexcept
+      {
+        return static_cast<unsigned char>(
+          unsigned(__d >= -4 ? (__d + 4) % 7 : (__d + 5) % 7 + 6));
+      }
+
+    public:
+
+      weekday() = default;
+
+      explicit constexpr
+      weekday(unsigned __wd) noexcept
+      : _M_wd(__wd == 7 ? 0 : __wd) // __wd % 7 ?
+      { }
+
+      constexpr
+      weekday(const sys_days& __dp) noexcept
+      : _M_wd(weekday::_S_from_days(__dp.time_since_epoch().count()))
+      { }
+
+      explicit constexpr
+      weekday(const local_days& __dp) noexcept
+      : _M_wd(weekday::_S_from_days(__dp.time_since_epoch().count()))
+      { }
+
+      constexpr weekday&
+      operator++() noexcept
+      {
+        ++this->_M_wd;
+        return *this;
+      }
+
+      constexpr weekday
+      operator++(int) noexcept
+      {
+        auto __ret(*this);
+        ++(*this);
+        return __ret;
+      }
+
+      constexpr weekday&
+      operator--() noexcept
+      {
+        --this->_M_wd;
+        return *this;
+      }
+
+      constexpr weekday
+      operator--(int) noexcept
+      {
+        auto __ret(*this);
+        --(*this);
+        return __ret;
+      }
+
+      constexpr weekday&
+      operator+=(const days& __d) noexcept
+      {
+        *this = *this + __d;
+        return *this;
+      }
+
+      constexpr weekday&
+      operator-=(const days& __d) noexcept
+      {
+        *this = *this - __d;
+        return *this;
+      }
+
+      explicit constexpr
+      operator unsigned() const noexcept
+      { return this->_M_wd; }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_wd <= 6; }
+
+      constexpr weekday_indexed
+      operator[](unsigned __index) const noexcept;
+
+      constexpr weekday_last
+      operator[](last_spec) const noexcept;
+    };
+
+    inline constexpr chrono::weekday Sunday{0};
+    inline constexpr chrono::weekday Monday{1};
+    inline constexpr chrono::weekday Tuesday{2};
+    inline constexpr chrono::weekday Wednesday{3};
+    inline constexpr chrono::weekday Thursday{4};
+    inline constexpr chrono::weekday Friday{5};
+    inline constexpr chrono::weekday Saturday{6};
+
+    constexpr bool
+    operator==(const weekday& __x, const weekday& __y) noexcept
+    { return unsigned{__x} == unsigned{__y}; }
+
+    constexpr bool
+    operator!=(const weekday& __x, const weekday& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr weekday
+    operator+(const weekday& __x, const days& __y) noexcept
+    { return weekday(__detail::__modulo<unsigned char>(
+			  static_cast<long long>(unsigned{__x})
+			  + __y.count(), 7)); }
+
+    constexpr weekday
+    operator+(const days& __x, const weekday& __y) noexcept
+    { return __y + __x; }
+
+    constexpr weekday
+    operator-(const weekday& __x, const days& __y) noexcept
+    { return __x + -__y; }
+
+    constexpr days
+    operator-(const weekday& __x, const weekday& __y) noexcept
+    {
+      const auto __dwd = int(unsigned(__x)) - int(unsigned(__y));
+      const auto __w = (__dwd >= 0 ? __dwd : __dwd - 6) / 7;
+      return days{__dwd - __w * 7};
+    }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os, const weekday& __wd);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      to_stream(std::basic_ostream<_CharT, _Traits>& __os, const _CharT* __fmt,
+	        const weekday& __wd);
+
+    template<typename _CharT, typename _Traits,
+	     typename _Alloc = allocator<_CharT>>
+      std::basic_istream<_CharT, _Traits>&
+      from_stream(std::basic_istream<_CharT, _Traits>& __is, const _CharT* __fmt,
+		  weekday& __wd,
+		  std::basic_string<_CharT, _Traits, _Alloc>* __abbrev = nullptr,
+		  minutes* __offset = nullptr);
+*/
+    // WEEKDAY_INDEXED
+
+    class weekday_indexed
+    {
+    private:
+
+      chrono::weekday _M_wd;
+      unsigned char _M_index;
+
+    public:
+
+      weekday_indexed() = default;
+
+      constexpr
+      weekday_indexed(const chrono::weekday& __wd, unsigned __index) noexcept
+      : _M_wd(__wd), _M_index(__index)
+      { }
+
+      constexpr chrono::weekday
+      weekday() const noexcept
+      { return this->_M_wd; }
+
+      constexpr unsigned
+      index() const noexcept
+      { return this->_M_index; };
+
+      constexpr bool
+      ok() const noexcept
+      { return _M_wd.ok() && 1 <= this->_M_index && this->_M_index <= 5; }
+    };
+
+    constexpr bool
+    operator==(const weekday_indexed& __x, const weekday_indexed& __y) noexcept
+    { return __x.weekday() == __y.weekday() && __x.index() == __y.index(); }
+
+    constexpr bool
+    operator!=(const weekday_indexed& __x, const weekday_indexed& __y) noexcept
+    { return !(__x == __y); }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const weekday_indexed& __wdi);
+*/
+    inline constexpr weekday_indexed
+    weekday::operator[](unsigned __index) const noexcept
+    { return {*this, __index}; }
+
+    // WEEKDAY_LAST
+
+    class weekday_last
+    {
+    private:
+
+      chrono::weekday _M_wd;
+
+    public:
+
+      explicit constexpr
+      weekday_last(const chrono::weekday& __wd) noexcept
+      : _M_wd{__wd}
+      { }
+
+      constexpr chrono::weekday
+      weekday() const noexcept
+      { return this->_M_wd; }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_wd.ok(); }
+    };
+
+    constexpr bool
+    operator==(const weekday_last& __x, const weekday_last& __y) noexcept
+    { return __x.weekday() == __y.weekday(); }
+
+    constexpr bool
+    operator!=(const weekday_last& __x, const weekday_last& __y) noexcept
+    { return !(__x == __y); }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const weekday_last& __wdl);
+*/
+    inline constexpr weekday_last
+    weekday::operator[](last_spec) const noexcept
+    { return weekday_last{*this}; }
+
+    // MONTH_DAY
+
+    class month_day
+    {
+      chrono::month _M_m;
+      chrono::day _M_d;
+
+    public:
+
+      month_day() = default;
+
+      constexpr
+      month_day(const chrono::month& __m, const chrono::day& __d) noexcept
+      : _M_m{__m}, _M_d{__d}
+      { }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_m; }
+
+      constexpr chrono::day
+      day() const noexcept
+      { return this->_M_d; }
+
+      constexpr bool
+      ok() const noexcept
+      {
+        return 1u <= unsigned(this->_M_d)
+	  && this->_M_m.ok()
+	  && unsigned(this->_M_d)
+	     <= __detail::__days_per_month[unsigned(this->_M_m) - 1];
+      }
+    };
+
+    constexpr bool
+    operator==(const month_day& __x, const month_day& __y) noexcept
+    { return __x.month() == __y.month() && __x.day() == __y.day(); }
+
+    constexpr bool
+    operator!=(const month_day& __x, const month_day& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr bool
+    operator<(const month_day& __x, const month_day& __y) noexcept
+    {
+      if (__x.month() < __y.month())
+        return true;
+      else if (__x.month() > __y.month())
+        return false;
+      else
+        return __x.day() < __y.day();
+    }
+
+    constexpr bool
+    operator>(const month_day& __x, const month_day& __y) noexcept
+    { return __y < __x; }
+
+    constexpr bool
+    operator<=(const month_day& __x, const month_day& __y) noexcept
+    { return !(__y < __x); }
+
+    constexpr bool
+    operator>=(const month_day& __x, const month_day& __y) noexcept
+    { return !(__x < __y); }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os, const month_day& __md);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      to_stream(std::basic_ostream<_CharT, _Traits>& __os,
+	        const _CharT* __fmt, const month_day& __md);
+
+    template<typename _CharT, typename _Traits,
+	     typename _Alloc = allocator<_CharT>>
+      std::basic_istream<_CharT, _Traits>&
+      from_stream(std::basic_istream<_CharT, _Traits>& __is, const _CharT* __fmt,
+		  month_day& __md,
+		  std::basic_string<_CharT, _Traits, _Alloc>* __abbrev = nullptr,
+		  minutes* __offset = nullptr);
+*/
+    // MONTH_DAY_LAST
+
+    class month_day_last
+    {
+    private:
+
+      chrono::month _M_m;
+
+    public:
+
+      explicit constexpr
+      month_day_last(const chrono::month& __m) noexcept
+      : _M_m{__m}
+      { }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_m; }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_m.ok(); }
+    };
+
+    constexpr bool
+    operator==(const month_day_last& __x, const month_day_last& __y) noexcept
+    { return __x.month() == __y.month(); }
+
+    constexpr bool
+    operator!=(const month_day_last& __x, const month_day_last& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr bool
+    operator<(const month_day_last& __x, const month_day_last& __y) noexcept
+    { return __x.month() < __y.month(); }
+
+    constexpr bool
+    operator>(const month_day_last& __x, const month_day_last& __y) noexcept
+    { return __y < __x; }
+
+    constexpr bool
+    operator<=(const month_day_last& __x, const month_day_last& __y) noexcept
+    { return !(__y < __x); }
+
+    constexpr bool
+    operator>=(const month_day_last& __x, const month_day_last& __y) noexcept
+    { return !(__x < __y); }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const month_day_last& __mdl);
+*/
+    // MONTH_WEEKDAY
+
+    class month_weekday
+    {
+    private:
+
+      chrono::month _M_m;
+      chrono::weekday_indexed _M_wdi;
+
+    public:
+
+      constexpr
+      month_weekday(const chrono::month& __m,
+		    const chrono::weekday_indexed& __wdi) noexcept
+      : _M_m{__m}, _M_wdi{__wdi}
+      { }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_m; }
+
+      constexpr chrono::weekday_indexed
+      weekday_indexed() const noexcept
+      { return this->_M_wdi; }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_m.ok() && this->_M_wdi.ok(); }
+    };
+
+    constexpr bool
+    operator==(const month_weekday& __x, const month_weekday& __y) noexcept
+    {
+      return __x.month() == __y.month()
+	  && __x.weekday_indexed() == __y.weekday_indexed();
+    }
+
+    constexpr bool
+    operator!=(const month_weekday& __x, const month_weekday& __y) noexcept
+    { return !(__x == __y); }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const month_weekday& __mwd);
+*/
+    // MONTH_WEEKDAY_LAST
+
+    class month_weekday_last
+    {
+    private:
+
+      chrono::month _M_m;
+      chrono::weekday_last _M_wdl;
+
+    public:
+
+      constexpr
+      month_weekday_last(const chrono::month& __m,
+                         const chrono::weekday_last& __wdl) noexcept
+      :_M_m{__m}, _M_wdl{__wdl}
+      { }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_m; }
+
+      constexpr chrono::weekday_last
+      weekday_last() const noexcept
+      { return this->_M_wdl; }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_m.ok() && this->_M_wdl.ok(); }
+    };
+
+    constexpr bool
+    operator==(const month_weekday_last& __x,
+	       const month_weekday_last& __y) noexcept
+    {
+      return __x.month() == __y.month()
+	  && __x.weekday_last() == __y.weekday_last();
+    }
+
+    constexpr bool
+    operator!=(const month_weekday_last& __x,
+	       const month_weekday_last& __y) noexcept
+    { return !(__x == __y); }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const month_weekday_last& __mwdl);
+*/
+    // YEAR_MONTH
+
+    class year_month
+    {
+    private:
+
+      chrono::year _M_y;
+      chrono::month _M_m;
+
+    public:
+
+      year_month() = default;
+
+      constexpr
+      year_month(const chrono::year& __y, const chrono::month& __m) noexcept
+      : _M_y{__y}, _M_m{__m}
+      { }
+
+      constexpr chrono::year
+      year() const noexcept
+      { return this->_M_y; }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_m; }
+
+      constexpr year_month&
+      operator+=(const months& __dm) noexcept
+      {
+        // Does this work for negative dm?
+        this->_M_y += years{__dm.count() / 12};
+        this->_M_m += months{__dm.count() % 12};
+        return *this;
+      }
+
+      constexpr year_month&
+      operator-=(const months& __dm) noexcept
+      {
+        this->operator+=(-__dm);
+        return *this;
+      }
+
+      constexpr year_month&
+      operator+=(const years& __dy)  noexcept
+      {
+        this->_M_y += __dy;
+        return *this;
+      }
+
+      constexpr year_month&
+      operator-=(const years& __dy)  noexcept
+      {
+        this->_M_y -= __dy;
+        return *this;
+      }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_y.ok() && this->_M_m.ok(); }
+    };
+
+    constexpr bool
+    operator==(const year_month& __x, const year_month& __y) noexcept
+    { return __x.year() == __y.year() && __x.month() == __y.month(); }
+
+    constexpr bool
+    operator!=(const year_month& __x, const year_month& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr bool
+    operator<(const year_month& __x, const year_month& __y) noexcept
+    {
+      if (__x.year() < __y.year())
+        return true;
+      else if (__x.year() > __y.year())
+        return false;
+      else
+        return __x.month() < __y.month();
+    }
+
+    constexpr bool
+    operator>(const year_month& __x, const year_month& __y) noexcept
+    { return __y < __x; }
+
+    constexpr bool
+    operator<=(const year_month& __x, const year_month& __y) noexcept
+    { return !(__y < __x); }
+
+    constexpr bool
+    operator>=(const year_month& __x, const year_month& __y) noexcept
+    { return !(__x < __y); }
+
+    constexpr year_month
+    operator+(const year_month& __ym, const months& __dm) noexcept
+    {
+      auto __ret = __ym;
+      return __ret += __dm;
+    }
+
+    constexpr year_month
+    operator+(const months& __dm, const year_month& __ym) noexcept
+    { return __ym + __dm; }
+
+    constexpr year_month
+    operator-(const year_month& __ym, const months& __dm) noexcept
+    { return __ym + -__dm; }
+
+    constexpr months
+    operator-(const year_month& __x, const year_month& __y) noexcept
+    {
+      return __x.year() - __y.year()
+	   + months{static_cast<int>(unsigned{__x.month()})
+		  - static_cast<int>(unsigned{__y.month()})};
+    }
+
+    constexpr year_month
+    operator+(const year_month& __ym, const years& __dy) noexcept
+    { return (__ym.year() + __dy) / __ym.month(); }
+
+    constexpr year_month
+    operator+(const years& __dy, const year_month& __ym) noexcept
+    { return __ym + __dy; }
+
+    constexpr year_month
+    operator-(const year_month& __ym, const years& __dy) noexcept
+    { return __ym + -__dy; }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const year_month& __ym);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      to_stream(std::basic_ostream<_CharT, _Traits>& __os,
+	        const _CharT* __fmt, const year_month& __ym);
+
+    template<typename _CharT, typename _Traits,
+	     typename _Alloc = allocator<_CharT>>
+      std::basic_istream<_CharT, _Traits>&
+      from_stream(std::basic_istream<_CharT, _Traits>& __is, const _CharT* __fmt,
+		  year_month& __ym,
+		  std::basic_string<_CharT, _Traits, _Alloc>* __abbrev = nullptr,
+		  minutes* __offset = nullptr);
+*/
+    // YEAR_MONTH_DAY
+
+    class year_month_day
+    {
+    private:
+
+      chrono::year _M_y;
+      chrono::month _M_m;
+      chrono::day _M_d;
+
+      static constexpr year_month_day _S_from_days(const days& __dp) noexcept;
+
+      constexpr days _M_days_since_epoch() const noexcept;
+
+    public:
+
+      year_month_day() = default;
+
+      constexpr
+      year_month_day(const chrono::year& __y, const chrono::month& __m,
+		     const chrono::day& __d) noexcept
+      : _M_y{__y}, _M_m{__m}, _M_d{__d}
+      { }
+
+      constexpr
+      year_month_day(const year_month_day_last& __ymdl) noexcept;
+
+      constexpr
+      year_month_day(const sys_days& __dp) noexcept
+      : year_month_day(year_month_day::_S_from_days(__dp.time_since_epoch()))
+      { }
+
+      explicit constexpr
+      year_month_day(const local_days& __dp) noexcept
+      : year_month_day(year_month_day::_S_from_days(__dp.time_since_epoch()))
+      { }
+
+      constexpr year_month_day&
+      operator+=(const months& __m) noexcept
+      {
+        chrono::year_month __ym(this->year(), this->month());
+        __ym += __m;
+        this->_M_y = __ym.year();
+        this->_M_m = __ym.month();
+        return *this;
+      }
+
+      constexpr year_month_day&
+      operator-=(const months& __m) noexcept
+      {
+        chrono::year_month __ym(this->year(), this->month());
+        __ym -= __m;
+        this->_M_y = __ym.year();
+        this->_M_m = __ym.month();
+        return *this;
+      }
+
+      constexpr year_month_day&
+      operator+=(const years& __y) noexcept
+      {
+        this->_M_y += __y;
+        return *this;
+      }
+
+      constexpr year_month_day&
+      operator-=(const years& __y) noexcept
+      {
+        this->_M_y -= __y;
+        return *this;
+      }
+
+      constexpr chrono::year
+      year() const noexcept
+      { return this->_M_y; }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_m; }
+
+      constexpr chrono::day
+      day() const noexcept
+      { return this->_M_d; }
+
+      constexpr
+      operator sys_days() const noexcept
+      { return sys_days{this->_M_days_since_epoch()}; }
+
+      explicit constexpr
+      operator local_days() const noexcept
+      { return local_days{this->_M_days_since_epoch()}; }
+
+      constexpr bool
+      ok() const noexcept
+      {
+        return this->_M_y.ok() && this->_M_m.ok() && this->_M_d.ok()
+	    && unsigned(this->_M_d)
+		  <= __detail::__days_per_month[unsigned(this->_M_m) - 1];
+      }
+    };
+
+    // Construct from days since 1970/01/01. Magic.
+    inline constexpr year_month_day
+    year_month_day::_S_from_days(const days& __dp) noexcept
+    {
+      const auto __z = __dp.count() + 719468;
+      const auto __era = (__z >= 0 ? __z : __z - 146096) / 146097;
+      const auto __doe = static_cast<unsigned>(__z - __era * 146097);
+      const auto __yoe = (__doe - __doe / 1460 + __doe / 36524 - __doe / 146096)
+		        / 365;
+      const auto __y = static_cast<days::rep>(__yoe) + __era * 400;
+      const auto __doy = __doe - (365 * __yoe + __yoe / 4 - __yoe / 100);
+      const auto __mp = (5 * __doy + 2) / 153;
+      const auto __d = __doy - (153 * __mp + 2) / 5 + 1;
+      const auto __m = __mp < 10 ? __mp + 3 : __mp - 9;
+      return year_month_day{chrono::year(__y + (__m <= 2)),
+			    chrono::month(__m), chrono::day(__d)};
+    }
+
+    // Days since 1970/01/01. Magic.
+    inline constexpr days
+    year_month_day::_M_days_since_epoch() const noexcept
+    {
+      const auto __y = static_cast<int>(this->_M_y) - (this->_M_m <= February);
+      const auto __m = static_cast<unsigned>(this->_M_m);
+      const auto __d = static_cast<unsigned>(this->_M_d);
+      const auto __era = (__y >= 0 ? __y : __y - 399) / 400;
+      // Year of "era" [0, 399].
+      const auto __yoe = static_cast<unsigned>(__y - __era * 400);
+      // Day of year [0, 365].
+      const auto __doy = (153 * (__m > 2 ? __m - 3 : __m + 9) + 2) / 5 + __d - 1;
+      // Day of "era" [0, 146096].
+      const auto __doe = __yoe * 365 + __yoe / 4 - __yoe / 100 + __doy;
+      const auto __days = __era * 146097 + static_cast<int>(__doe) - 719468;
+      return days{__days};
+    }
+
+    constexpr bool
+    operator==(const year_month_day& __x, const year_month_day& __y) noexcept
+    {
+      return __x.year() == __y.year()
+	  && __x.month() == __y.month()
+	  && __x.day() == __y.day();
+    }
+
+    constexpr bool
+    operator!=(const year_month_day& __x, const year_month_day& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr bool
+    operator<(const year_month_day& __x, const year_month_day& __y) noexcept
+    {
+      if (__x.year() < __y.year())
+        return true;
+      else if (__x.year() > __y.year())
+        return false;
+      else
+        {
+	  if (__x.month() < __y.month())
+	    return true;
+	  else if (__x.month() > __y.month())
+	    return false;
+	  else
+	    return __x.day() < __y.day();
+        }
+    }
+
+    constexpr bool
+    operator>(const year_month_day& __x, const year_month_day& __y) noexcept
+    { return __y < __x; }
+
+    constexpr bool
+    operator<=(const year_month_day& __x, const year_month_day& __y) noexcept
+    { return !(__y < __x); }
+
+    constexpr bool
+    operator>=(const year_month_day& __x, const year_month_day& __y) noexcept
+    { return !(__x < __y); }
+
+    constexpr year_month_day
+    operator+(const year_month_day& __ymd, const months& __dm) noexcept
+    { return (__ymd.year() / __ymd.month() + __dm) / __ymd.day(); }
+
+    constexpr year_month_day
+    operator+(const months& __dm, const year_month_day& __ymd) noexcept
+    { return __ymd + __dm; }
+
+    constexpr year_month_day
+    operator+(const year_month_day& __ymd, const years& __dy) noexcept
+    { return (__ymd.year() + __dy) / __ymd.month() / __ymd.day(); }
+
+    constexpr year_month_day
+    operator+(const years& __dy, const year_month_day& __ymd) noexcept
+    { return __ymd + __dy; }
+
+    constexpr year_month_day
+    operator-(const year_month_day& __ymd, const months& __dm) noexcept
+    { return __ymd + -__dm; }
+
+    constexpr year_month_day
+    operator-(const year_month_day& __ymd, const years& __dy) noexcept
+    { return __ymd + -__dy; }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const year_month_day& __ymd);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      to_stream(std::basic_ostream<_CharT, _Traits>& __os,
+	        const _CharT* __fmt, const year_month_day& __ymd);
+
+    template<typename _CharT, typename _Traits,
+	     typename _Alloc = allocator<_CharT>>
+      std::basic_istream<_CharT, _Traits>&
+      from_stream(std::basic_istream<_CharT, _Traits>& __is, const _CharT* __fmt,
+		  year_month_day& __ymd,
+		  std::basic_string<_CharT, _Traits, _Alloc>* __abbrev = nullptr,
+		  minutes* __offset = nullptr);
+*/
+    // YEAR_MONTH_DAY_LAST
+
+    class year_month_day_last
+    {
+    private:
+
+      chrono::year _M_y;
+      chrono::month_day_last _M_mdl;
+
+    public:
+
+      constexpr
+      year_month_day_last(const chrono::year& __y,
+                          const chrono::month_day_last& __mdl) noexcept
+      : _M_y{__y}, _M_mdl{__mdl}
+      { }
+
+      constexpr year_month_day_last&
+      operator+=(const months& __m) noexcept
+      {
+        *this = *this + __m;
+        return *this;
+      }
+
+      constexpr year_month_day_last&
+      operator-=(const months& __m) noexcept
+      {
+        *this = *this - __m;
+        return *this;
+      }
+
+      constexpr year_month_day_last&
+      operator+=(const years& __y)  noexcept
+      {
+        *this = *this + __y;
+        return *this;
+      }
+
+      constexpr year_month_day_last&
+      operator-=(const years& __y)  noexcept
+      {
+        *this = *this - __y;
+        return *this;
+      }
+
+      constexpr chrono::year
+      year() const noexcept
+      { return this->_M_y; }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_mdl.month(); }
+
+      constexpr chrono::month_day_last
+      month_day_last() const noexcept
+      { return this->_M_mdl; }
+
+      // Return A day representing the last day of this year, month pair.
+      constexpr chrono::day
+      day() const noexcept
+      {
+        return this->month() != chrono::month{2}
+	  || !this->_M_y.is_leap()
+	   ? chrono::day{__detail::__last_day[unsigned(this->_M_mdl.month()) - 1]}
+	   : chrono::day{29};
+      }
+
+      constexpr
+      operator sys_days() const noexcept
+      { return sys_days{this->year() / this->month() / this->day()}; }
+
+      explicit constexpr
+      operator local_days() const noexcept
+      { return local_days{sys_days{*this}.time_since_epoch()}; }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_y.ok() && this->_M_mdl.ok(); }
+    };
+
+    // year_month_day ctor from year_month_day_last
+    inline constexpr
+    year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
+    : _M_y{__ymdl.year()}, _M_m{__ymdl.month()}, _M_d{__ymdl.day()}
+    { }
+
+    constexpr bool
+    operator==(const year_month_day_last& __x,
+	       const year_month_day_last& __y) noexcept
+    {
+      return __x.year() == __y.year()
+	  && __x.month_day_last() == __y.month_day_last();
+    }
+
+    constexpr bool
+    operator!=(const year_month_day_last& __x,
+	       const year_month_day_last& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr bool
+    operator<(const year_month_day_last& __x,
+	      const year_month_day_last& __y) noexcept
+    {
+      if (__x.year() < __y.year())
+        return true;
+      else if (__x.year() > __y.year())
+        return false;
+      else
+        return __x.month_day_last() < __y.month_day_last();
+    }
+
+    constexpr bool
+    operator>(const year_month_day_last& __x,
+	      const year_month_day_last& __y) noexcept
+    { return __y < __x; }
+
+    constexpr bool
+    operator<=(const year_month_day_last& __x,
+	       const year_month_day_last& __y) noexcept
+    { return !(__y < __x); }
+
+    constexpr bool
+    operator>=(const year_month_day_last& __x,
+	       const year_month_day_last& __y) noexcept
+    { return !(__x < __y); }
+
+    constexpr year_month_day_last
+    operator+(const year_month_day_last& __ymdl,
+	      const months& __dm) noexcept
+    { return (__ymdl.year() / __ymdl.month() + __dm) / last; }
+
+    constexpr year_month_day_last
+    operator+(const months& __dm,
+	      const year_month_day_last& __ymdl) noexcept
+    { return __ymdl + __dm; }
+
+    constexpr year_month_day_last
+    operator-(const year_month_day_last& __ymdl,
+	      const months& __dm) noexcept
+    { return __ymdl + -__dm; }
+
+    constexpr year_month_day_last
+    operator+(const year_month_day_last& __ymdl,
+	      const years& __dy) noexcept
+    { return {__ymdl.year() + __dy, __ymdl.month_day_last()}; }
+
+    constexpr year_month_day_last
+    operator+(const years& __dy,
+	      const year_month_day_last& __ymdl) noexcept
+    { return __ymdl + __dy; }
+
+    constexpr year_month_day_last
+    operator-(const year_month_day_last& __ymdl,
+	      const years& __dy) noexcept
+    { return __ymdl + -__dy; }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const year_month_day_last& __ymdl);
+*/
+    // YEAR_MONTH_WEEKDAY
+
+    class year_month_weekday
+    {
+    private:
+
+      chrono::year            _M_y;
+      chrono::month           _M_m;
+      chrono::weekday_indexed _M_wdi;
+
+    public:
+
+      year_month_weekday() = default;
+
+      constexpr
+      year_month_weekday(const chrono::year& __y, const chrono::month& __m,
+                         const chrono::weekday_indexed& __wdi) noexcept
+      : _M_y{__y}, _M_m{__m}, _M_wdi{__wdi}
+      { }
+
+      constexpr
+      year_month_weekday(const sys_days& __dp) noexcept;
+
+      explicit constexpr
+      year_month_weekday(const local_days& __dp) noexcept;
+
+      constexpr year_month_weekday&
+      operator+=(const months& __m) noexcept;
+
+      constexpr year_month_weekday&
+      operator-=(const months& __m) noexcept;
+
+      constexpr year_month_weekday&
+      operator+=(const years& __y) noexcept;
+
+      constexpr year_month_weekday&
+      operator-=(const years& y) noexcept;
+
+      constexpr chrono::year
+      year() const noexcept
+      { return this->_M_y; }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_m; }
+
+      constexpr chrono::weekday
+      weekday() const noexcept
+      { return this->_M_wdi.weekday(); }
+
+      constexpr unsigned
+      index() const noexcept
+      { return this->_M_wdi.index(); }
+
+      constexpr chrono::weekday_indexed
+      weekday_indexed() const noexcept
+      { return this->_M_wdi; }
+
+      constexpr
+      operator sys_days() const noexcept;
+
+      explicit constexpr
+      operator local_days() const noexcept
+      { local_days{sys_days{*this}.time_since_epoch()}; }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_y.ok() && this->_M_m.ok() && this->_M_wdi.ok(); }
+    };
+
+    constexpr bool
+    operator==(const year_month_weekday& __x,
+	       const year_month_weekday& __y) noexcept
+    {
+      return __x.year() == __y.year()
+	  && __x.month() == __y.month()
+	  && __x.weekday() == __y.weekday();
+    }
+
+    constexpr bool
+    operator!=(const year_month_weekday& __x,
+	       const year_month_weekday& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr year_month_weekday
+    operator+(const year_month_weekday& __ymwd, const months& __dm) noexcept
+    { return (__ymwd.year() / __ymwd.month() + __dm) / __ymwd.weekday_indexed(); }
+
+    constexpr year_month_weekday
+    operator+(const months& __dm, const year_month_weekday& __ymwd) noexcept
+    { return __ymwd + __dm; }
+
+    constexpr year_month_weekday
+    operator+(const year_month_weekday& __ymwd, const years& __dy) noexcept
+    { return {__ymwd.year() + __dy, __ymwd.month(), __ymwd.weekday_indexed()}; }
+
+    constexpr year_month_weekday
+    operator+(const years& __dy, const year_month_weekday& __ymwd) noexcept
+    { return __ymwd + __dy; }
+
+    constexpr year_month_weekday
+    operator-(const year_month_weekday& __ymwd, const months& __dm) noexcept
+    { return __ymwd + -__dm; }
+
+    constexpr year_month_weekday
+    operator-(const year_month_weekday& __ymwd, const years& __dy) noexcept
+    { return __ymwd + -__dy; }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const year_month_weekday& __ymwdi);
+*/
+    // YEAR_MONTH_WEEKDAY_LAST
+
+    class year_month_weekday_last
+    {
+    private:
+
+      chrono::year _M_y;
+      chrono::month _M_m;
+      chrono::weekday_last _M_wdl;
+
+    public:
+
+      constexpr
+      year_month_weekday_last(const chrono::year& __y, const chrono::month& __m,
+                              const chrono::weekday_last& __wdl) noexcept
+      : _M_y{__y}, _M_m{__m}, _M_wdl{__wdl}
+      { }
+
+      constexpr year_month_weekday_last&
+      operator+=(const months& __m) noexcept
+      {
+        *this = *this + __m;
+        return *this;
+      }
+
+      constexpr year_month_weekday_last&
+      operator-=(const months& __m) noexcept
+      {
+        *this = *this - __m;
+        return *this;
+      }
+
+      constexpr year_month_weekday_last&
+      operator+=(const years& __y)  noexcept
+      {
+        *this = *this + __y;
+        return *this;
+      }
+
+      constexpr year_month_weekday_last&
+      operator-=(const years& __y)  noexcept
+      {
+        *this = *this - __y;
+        return *this;
+      }
+
+      constexpr chrono::year
+      year() const noexcept
+      { return this->_M_y; }
+
+      constexpr chrono::month
+      month() const noexcept
+      { return this->_M_m; }
+
+      constexpr chrono::weekday
+      weekday() const noexcept
+      { return this->_M_wdl.weekday(); }
+
+      constexpr chrono::weekday_last
+      weekday_last() const noexcept
+      { return this->_M_wdl; }
+
+      constexpr
+      operator sys_days() const noexcept
+      {
+        const auto __d = sys_days(this->_M_y / this->_M_m / last);
+        return sys_days{(__d - (chrono::weekday{__d}
+			     - this->_M_wdl.weekday())).time_since_epoch()};
+      }
+
+      explicit constexpr
+      operator local_days() const noexcept
+      { return local_days{sys_days{*this}.time_since_epoch()}; }
+
+      constexpr bool
+      ok() const noexcept
+      { return this->_M_y.ok() && this->_M_m.ok() && this->_M_wdl.ok(); }
+    };
+
+    constexpr bool
+    operator==(const year_month_weekday_last& __x,
+	       const year_month_weekday_last& __y) noexcept
+    {
+      return __x.year() == __y.year()
+	  && __x.month() == __y.month()
+	  && __x.weekday_last() == __y.weekday_last();
+    }
+
+    constexpr bool
+    operator!=(const year_month_weekday_last& __x,
+	       const year_month_weekday_last& __y) noexcept
+    { return !(__x == __y); }
+
+    constexpr year_month_weekday_last
+    operator+(const year_month_weekday_last& __ymwdl,
+	      const months& __dm) noexcept
+    { return (__ymwdl.year() / __ymwdl.month() + __dm) / __ymwdl.weekday_last(); }
+
+    constexpr year_month_weekday_last
+    operator+(const months& __dm,
+	      const year_month_weekday_last& __ymwdl) noexcept
+    { return __ymwdl + __dm; }
+
+    constexpr year_month_weekday_last
+    operator+(const year_month_weekday_last& __ymwdl,
+	      const years& __dy) noexcept
+    { return {__ymwdl.year() + __dy, __ymwdl.month(), __ymwdl.weekday_last()}; }
+
+    constexpr year_month_weekday_last
+    operator+(const years& __dy,
+	      const year_month_weekday_last& __ymwdl) noexcept
+    { return __ymwdl + __dy; }
+
+    constexpr year_month_weekday_last
+    operator-(const year_month_weekday_last& __ymwdl,
+	      const months& __dm) noexcept
+    { return __ymwdl + -__dm; }
+
+    constexpr year_month_weekday_last
+    operator-(const year_month_weekday_last& __ymwdl,
+	      const years& __dy) noexcept
+    { return __ymwdl + -__dy; }
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const year_month_weekday_last& __ymwdl);
+*/
+    // CALENDAR COMPOSITION OPERATORS
+
+    constexpr year_month
+    operator/(const year& __y, const month& __m) noexcept
+    { return {__y, __m}; }
+
+    constexpr year_month
+    operator/(const year& __y, int __m) noexcept
+    { return {__y, month(unsigned(__m))}; }
+
+    constexpr month_day
+    operator/(const month& __m, const day& __d) noexcept
+    { return {__m, __d}; }
+
+    constexpr month_day
+    operator/(const month& __m, int __d) noexcept
+    { return {__m, day(unsigned(__d))}; }
+
+    constexpr month_day
+    operator/(int __m, const day& __d) noexcept
+    { return {month(unsigned(__m)), __d}; }
+
+    constexpr month_day
+    operator/(const day& __d, const month& __m) noexcept
+    { return {__m, __d}; }
+
+    constexpr month_day
+    operator/(const day& __d, int __m) noexcept
+    { return {month(unsigned(__m)), __d}; }
+
+    constexpr month_day_last
+    operator/(const month& __m, last_spec) noexcept
+    { return month_day_last{__m}; }
+
+    constexpr month_day_last
+    operator/(int __m, last_spec) noexcept
+    { return month(unsigned(__m)) / last; }
+
+    constexpr month_day_last
+    operator/(last_spec, const month& __m) noexcept
+    { return __m / last; }
+
+    constexpr month_day_last
+    operator/(last_spec, int __m) noexcept
+    { return __m / last; }
+
+    constexpr month_weekday
+    operator/(const month& __m, const weekday_indexed& __wdi) noexcept
+    { return {__m, __wdi}; }
+
+    constexpr month_weekday
+    operator/(int __m, const weekday_indexed& __wdi) noexcept
+    { return month(unsigned(__m)) / __wdi; }
+
+    constexpr month_weekday
+    operator/(const weekday_indexed& __wdi, const month& __m) noexcept
+    { return __m / __wdi; }
+
+    constexpr month_weekday
+    operator/(const weekday_indexed& __wdi, int __m) noexcept
+    { return __m / __wdi; }
+
+    constexpr month_weekday_last
+    operator/(const month& __m, const weekday_last& __wdl) noexcept
+    { return {__m, __wdl}; }
+
+    constexpr month_weekday_last
+    operator/(int __m, const weekday_last& __wdl) noexcept
+    { return month(unsigned(__m)) / __wdl; }
+
+    constexpr month_weekday_last
+    operator/(const weekday_last& __wdl, const month& __m) noexcept
+    { return __m / __wdl; }
+
+    constexpr month_weekday_last
+    operator/(const weekday_last& __wdl, int __m) noexcept
+    { return chrono::month(unsigned(__m)) / __wdl; }
+
+    constexpr year_month_day
+    operator/(const year_month& __ym, const day& __d) noexcept
+    { return {__ym.year(), __ym.month(), __d}; }
+
+    constexpr year_month_day
+    operator/(const year_month& __ym, int __d) noexcept
+    { return __ym / chrono::day{unsigned(__d)}; }
+
+    constexpr year_month_day
+    operator/(const year& __y, const month_day& __md) noexcept
+    { return __y / __md.month() / __md.day(); }
+
+    constexpr year_month_day
+    operator/(int __y, const month_day& __md) noexcept
+    { return chrono::year{__y} / __md; }
+
+    constexpr year_month_day
+    operator/(const month_day& __md, const year& __y) noexcept
+    { return __y / __md; }
+
+    constexpr year_month_day
+    operator/(const month_day& __md, int __y) noexcept
+    { return chrono::year(__y) / __md; }
+
+    constexpr year_month_day_last
+    operator/(const year_month& __ym, last_spec) noexcept
+    { return {__ym.year(), month_day_last{__ym.month()}}; }
+
+    constexpr year_month_day_last
+    operator/(const year& __y, const month_day_last& __mdl) noexcept
+    { return {__y, __mdl}; }
+
+    constexpr year_month_day_last
+    operator/(int __y, const month_day_last& __mdl) noexcept
+    { return year(__y) / __mdl; }
+
+    constexpr year_month_day_last
+    operator/(const month_day_last& __mdl, const year& __y) noexcept
+    { return __y / __mdl; }
+
+    constexpr year_month_day_last
+    operator/(const month_day_last& __mdl, int __y) noexcept
+    { return year(__y) / __mdl; }
+
+    constexpr year_month_weekday
+    operator/(const year_month& __ym, const weekday_indexed& __wdi) noexcept
+    { return {__ym.year(), __ym.month(), __wdi}; }
+
+    constexpr year_month_weekday
+    operator/(const year& __y, const month_weekday& __mwd) noexcept
+    { return {__y, __mwd.month(), __mwd.weekday_indexed()}; }
+
+    constexpr year_month_weekday
+    operator/(int __y, const month_weekday& __mwd) noexcept
+    { return year(__y) / __mwd; }
+
+    constexpr year_month_weekday
+    operator/(const month_weekday& __mwd, const year& __y) noexcept
+    { return __y / __mwd; }
+
+    constexpr year_month_weekday
+    operator/(const month_weekday& __mwd, int __y) noexcept
+    { return year(__y) / __mwd; }
+
+    constexpr year_month_weekday_last
+    operator/(const year_month& __ym, const weekday_last& __wdl) noexcept
+    { return {__ym.year(), __ym.month(), __wdl}; }
+
+    constexpr year_month_weekday_last
+    operator/(const year& __y, const month_weekday_last& __mwdl) noexcept
+    { return {__y, __mwdl.month(), __mwdl.weekday_last()}; }
+
+    constexpr year_month_weekday_last
+    operator/(int __y, const month_weekday_last& __mwdl) noexcept
+    { return year(__y) / __mwdl; }
+
+    constexpr year_month_weekday_last
+    operator/(const month_weekday_last& __mwdl, const year& __y) noexcept
+    { __y / __mwdl; }
+
+    constexpr year_month_weekday_last
+    operator/(const month_weekday_last& __mwdl, int __y) noexcept
+    { year(__y) / __mwdl; }
+
+    // TIME_OF_DAY
+
+    template<typename _Duration>
+      class time_of_day;
+
+    template<>
+      class time_of_day<hours>
+      {
+      public:
+
+        using precision = chrono::hours;
+
+        time_of_day() = default;
+
+        explicit constexpr
+        time_of_day(chrono::hours __since_midnight) noexcept;
+
+        constexpr chrono::hours
+        hours() const noexcept;
+
+        explicit constexpr
+        operator precision() const noexcept;
+
+        constexpr precision
+        to_duration() const noexcept;
+
+        constexpr void
+        make24() noexcept;
+
+        constexpr void
+        make12() noexcept;
+      };
+
+    template<>
+      class time_of_day<minutes>
+      {
+      public:
+
+        using precision = chrono::minutes;
+
+        time_of_day() = default;
+
+        explicit constexpr
+        time_of_day(chrono::minutes __since_midnight) noexcept;
+
+        constexpr chrono::hours
+        hours() const noexcept;
+
+        constexpr chrono::minutes
+        minutes() const noexcept;
+
+        explicit constexpr
+        operator precision() const noexcept;
+
+        constexpr precision
+        to_duration() const noexcept;
+
+        constexpr void
+        make24() noexcept;
+
+        constexpr void
+        make12() noexcept;
+      };
+
+    template<>
+      class time_of_day<seconds>
+      {
+        public:
+
+        using precision = chrono::seconds;
+
+        time_of_day() = default;
+
+        explicit constexpr
+        time_of_day(chrono::seconds __since_midnight) noexcept;
+
+        constexpr chrono::hours
+        hours() const noexcept;
+
+        constexpr chrono::minutes
+        minutes() const noexcept;
+
+        constexpr chrono::seconds
+        seconds() const noexcept;
+
+        explicit constexpr
+        operator precision() const noexcept;
+
+        constexpr precision
+        to_duration() const noexcept;
+
+        constexpr void
+        make24() noexcept;
+
+        constexpr void
+        make12() noexcept;
+      };
+
+    template<typename _Rep, typename _Period>
+      class time_of_day<duration<_Rep, _Period>>;
+/*
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const time_of_day<hours>& __t);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const time_of_day<minutes>& __t);
+
+    template<typename _CharT, typename _Traits>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const time_of_day<seconds>& __t);
+
+    template<typename _CharT, typename _Traits, typename _Rep, typename _Period>
+      std::basic_ostream<_CharT, _Traits>&
+      operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	         const time_of_day<duration<_Rep, _Period>>& __t);
+*/
+#endif // C++20
+
+    // @}
+  } // namespace chrono
+
+#if __cplusplus > 201103L
+
+#define __cpp_lib_chrono_udls 201304
+
+  inline namespace literals
+  {
+  /** ISO C++ 2014  namespace for suffixes for duration literals.
+   *
+   * These suffixes can be used to create `chrono::duration` values with
+   * tick periods of hours, minutes, seconds, milliseconds, microseconds
+   * or nanoseconds. For example, `std::chrono::seconds(5)` can be written
+   * as `5s` after making the suffix visible in the current scope.
+   * The suffixes can be made visible by a using-directive or
+   * using-declaration such as:
+   *  - `using namespace std::chrono_literals;`
+   *  - `using namespace std::literals;`
+   *  - `using namespace std::chrono;`
+   *  - `using namespace std;`
+   *  - `using std::chrono_literals::operator""s;`
+   *
+   * The result of these suffixes on an integer literal is one of the
+   * standard typedefs such as `std::chrono::hours`.
+   * The result on a floating-point literal is a duration type with the
+   * specified tick period and an unspecified floating-point representation,
+   * for example `1.5e2ms` might be equivalent to
+   * `chrono::duration<long double, chrono::milli>(1.5e2)`.
+   *
+   * @ingroup chrono
+   */
+  inline namespace chrono_literals
+  {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wliteral-suffix"
+    /// @cond undocumented
+    template<typename _Dur, char... _Digits>
+      constexpr _Dur __check_overflow()
+      {
+	using _Val = __parse_int::_Parse_int<_Digits...>;
+	constexpr typename _Dur::rep __repval = _Val::value;
+	static_assert(__repval >= 0 && __repval == _Val::value,
+		      "literal value cannot be represented by duration type");
+	return _Dur(__repval);
+      }
+    /// @endcond
+
+    /// Literal suffix for durations representing non-integer hours
+    constexpr chrono::duration<long double, ratio<3600,1>>
+    operator""h(long double __hours)
+    { return chrono::duration<long double, ratio<3600,1>>{__hours}; }
+
+    /// Literal suffix for durations of type `std::chrono::hours`
+    template <char... _Digits>
+      constexpr chrono::hours
+      operator""h()
+      { return __check_overflow<chrono::hours, _Digits...>(); }
+
+    /// Literal suffix for durations representing non-integer minutes
+    constexpr chrono::duration<long double, ratio<60,1>>
+    operator""min(long double __mins)
+    { return chrono::duration<long double, ratio<60,1>>{__mins}; }
+
+    /// Literal suffix for durations of type `std::chrono::minutes`
+    template <char... _Digits>
+      constexpr chrono::minutes
+      operator""min()
+      { return __check_overflow<chrono::minutes, _Digits...>(); }
+
+    /// Literal suffix for durations representing non-integer seconds
+    constexpr chrono::duration<long double>
+    operator""s(long double __secs)
+    { return chrono::duration<long double>{__secs}; }
+
+    /// Literal suffix for durations of type `std::chrono::seconds`
+    template <char... _Digits>
+      constexpr chrono::seconds
+      operator""s()
+      { return __check_overflow<chrono::seconds, _Digits...>(); }
+
+    /// Literal suffix for durations representing non-integer milliseconds
+    constexpr chrono::duration<long double, milli>
+    operator""ms(long double __msecs)
+    { return chrono::duration<long double, milli>{__msecs}; }
+
+    /// Literal suffix for durations of type `std::chrono::milliseconds`
+    template <char... _Digits>
+      constexpr chrono::milliseconds
+      operator""ms()
+      { return __check_overflow<chrono::milliseconds, _Digits...>(); }
+
+    /// Literal suffix for durations representing non-integer microseconds
+    constexpr chrono::duration<long double, micro>
+    operator""us(long double __usecs)
+    { return chrono::duration<long double, micro>{__usecs}; }
+
+    /// Literal suffix for durations of type `std::chrono::microseconds`
+    template <char... _Digits>
+      constexpr chrono::microseconds
+      operator""us()
+      { return __check_overflow<chrono::microseconds, _Digits...>(); }
+
+    /// Literal suffix for durations representing non-integer nanoseconds
+    constexpr chrono::duration<long double, nano>
+    operator""ns(long double __nsecs)
+    { return chrono::duration<long double, nano>{__nsecs}; }
+
+    /// Literal suffix for durations of type `std::chrono::nanoseconds`
+    template <char... _Digits>
+      constexpr chrono::nanoseconds
+      operator""ns()
+      { return __check_overflow<chrono::nanoseconds, _Digits...>(); }
+
+#if __cplusplus > 201703L
+    constexpr chrono::day
+    operator""d(unsigned long long __d) noexcept
+    { return chrono::day{static_cast<unsigned>(__d)}; }
+
+    constexpr chrono::year
+    operator""y(unsigned long long __y) noexcept
+    { return chrono::year{static_cast<int>(__y)}; }
+#endif // C++20
 
 #pragma GCC diagnostic pop
   } // inline namespace chrono_literals
diff --git a/libstdc++-v3/testsuite/20_util/day/1.cc b/libstdc++-v3/testsuite/20_util/day/1.cc
new file mode 100644
index 00000000000..01ee1947573
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/day/1.cc
@@ -0,0 +1,56 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.day]
+
+#include <chrono>
+
+constexpr void
+constexpr_day()
+{
+  using namespace std::chrono;
+
+  day dd{};
+  ++dd;
+  dd++;
+  --dd;
+  dd--;
+  dd += days{3};
+  dd -= days{3};
+
+  static_assert(++day{4} == day{5});
+  static_assert(day{4}++ == day{4});
+  static_assert(--day{4} == day{3});
+  static_assert(day{4}-- == day{4});
+  static_assert((day{4} += days{3}) == day{7});
+  static_assert((day{4} -= days{3}) == day{1});
+
+  static_assert(!day{}.ok());
+  static_assert(day{1}.ok());
+  static_assert(day{31}.ok());
+  static_assert(!day{32}.ok());
+
+  static_assert(!(day{0} == day{1}));
+  static_assert( (day{0} != day{2}));
+  static_assert( (day{0} <  day{3}));
+  static_assert(!(day{0} >  day{4}));
+  static_assert( (day{0} <= day{5}));
+  static_assert(!(day{0} >= day{6}));
+}
diff --git a/libstdc++-v3/testsuite/20_util/month/1.cc b/libstdc++-v3/testsuite/20_util/month/1.cc
new file mode 100644
index 00000000000..5a3c3e8be36
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month/1.cc
@@ -0,0 +1,59 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.month]
+
+#include <chrono>
+
+constexpr void
+constexpr_month()
+{
+  using namespace std::chrono;
+
+  month dm{};
+  ++dm;
+  dm++;
+  --dm;
+  dm--;
+  dm += months{3};
+  dm -= months{3};
+
+  static_assert(February + months{11} == January);
+  static_assert(January - February == months{11});
+
+  static_assert(++month{4} == month{5});
+  static_assert(month{4}++ == month{4});
+  static_assert(--month{4} == month{3});
+  static_assert(month{4}-- == month{4});
+  static_assert((month{4} += months{3}) == month{7});
+  static_assert((month{4} -= months{3}) == month{1});
+
+  static_assert(!month{}.ok());
+  static_assert(month{1}.ok());
+  static_assert(month{12}.ok());
+  static_assert(!month{13}.ok());
+
+  static_assert(!(month{0} == month{1}));
+  static_assert( (month{0} != month{2}));
+  static_assert( (month{0} <  month{3}));
+  static_assert(!(month{0} >  month{4}));
+  static_assert( (month{0} <= month{5}));
+  static_assert(!(month{0} >= month{6}));
+}
diff --git a/libstdc++-v3/testsuite/20_util/month_day/1.cc b/libstdc++-v3/testsuite/20_util/month_day/1.cc
new file mode 100644
index 00000000000..2ce73b81973
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month_day/1.cc
@@ -0,0 +1,67 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template month_day [time.cal.month_day]
+
+#include <chrono>
+
+constexpr void
+constexpr_month_day()
+{
+  using namespace std::chrono;
+  using md = month_day;
+
+  //constexpr unsigned
+  //dim[12]
+  //{31u, 29u, 31u, 30u, 31u, 30u, 31u, 31u, 30u, 31u, 30u, 31u};
+
+  month_day md0 = April/4;
+  month_day md2 = 4d/April;
+
+  constexpr auto md1 = month_day{month{3}, day{13}};
+  static_assert(md1.month() == month{3});
+  static_assert(md1.day() == day{13});
+
+  static_assert(!month_day{month{1}, day{}}.ok());
+  static_assert( month_day{month{2}, day{1}}.ok());
+  static_assert( month_day{month{3}, day{31}}.ok());
+  static_assert(!month_day{month{4}, day{32}}.ok());
+  static_assert(!month_day{month{0}, day{11}}.ok());
+  static_assert(!month_day{month{13}, day{7}}.ok());
+  static_assert( month_day{month{2}, day{28}}.ok());
+  static_assert( month_day{month{2}, day{29}}.ok());
+  static_assert(!month_day{month{2}, day{30}}.ok());
+  //for (unsigned m = 0u; m < 12u; ++m)
+  //  for (unsigned d = 1u; d <= dim[m]; ++d)
+  //    static_assert(month_day{month{m+1u}, day{d}}.ok());
+
+  static_assert(!(md{month{1}, day{0}} == md{month{1}, day{1}}));
+  static_assert( (md{month{2}, day{0}} != md{month{2}, day{2}}));
+  static_assert( (md{month{3}, day{0}} <  md{month{3}, day{3}}));
+  static_assert(!(md{month{4}, day{0}} >  md{month{4}, day{4}}));
+  static_assert( (md{month{5}, day{0}} <= md{month{5}, day{5}}));
+  static_assert(!(md{month{6}, day{0}} >= md{month{6}, day{6}}));
+  static_assert( (md{month{10}, day{13}} == md{month{10}, day{13}}));
+  static_assert( (md{month{9}, day{13}} != md{month{10}, day{13}}));
+  static_assert( (md{month{8}, day{13}} < md{month{10}, day{13}}));
+  static_assert( (md{month{11}, day{13}} > md{month{10}, day{13}}));
+  static_assert( (md{month{10}, day{13}} <= md{month{10}, day{13}}));
+  static_assert( (md{month{10}, day{13}} >= md{month{10}, day{13}}));
+}
diff --git a/libstdc++-v3/testsuite/20_util/month_day/operations.cc b/libstdc++-v3/testsuite/20_util/month_day/operations.cc
new file mode 100644
index 00000000000..67969639be8
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month_day/operations.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template month_day [time.cal.month_day]
+
+#include <chrono>
+
+constexpr void
+constexpr_month_day()
+{
+  using namespace std::chrono;
+
+  // Div ops...
+  static_assert(August/14d == month_day{month{8}, day{14}});
+  static_assert(August/14 == month_day{month{8}, day{14}});
+  static_assert(8/14d == month_day{month{8}, day{14}});
+  static_assert(14d/August == month_day{month{8}, day{14}});
+  static_assert(14d/8 == month_day{month{8}, day{14}});
+}
diff --git a/libstdc++-v3/testsuite/20_util/month_day_last/1.cc b/libstdc++-v3/testsuite/20_util/month_day_last/1.cc
new file mode 100644
index 00000000000..832dec60453
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month_day_last/1.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.month_day_last]
+
+#include <chrono>
+
+constexpr void
+constexpr_month_day_last()
+{
+  using namespace std::chrono;
+  using mdl = month_day_last;
+
+  constexpr auto mdl0 = February / last;
+  static_assert(mdl0.month() == February);
+
+  constexpr auto mdl1 = month_day_last{month{3}};
+  static_assert(mdl1.month() == month{3});
+
+  static_assert( mdl{month{3}}.ok());
+  static_assert(!mdl{month{0}}.ok());
+  static_assert(!mdl{month{13}}.ok());
+
+  static_assert( (mdl{month{1}} == mdl{month{1}}));
+  static_assert(!(mdl{month{2}} != mdl{month{2}}));
+  static_assert(!(mdl{month{3}} <  mdl{month{3}}));
+  static_assert(!(mdl{month{4}} >  mdl{month{4}}));
+  static_assert( (mdl{month{5}} <= mdl{month{5}}));
+  static_assert( (mdl{month{6}} >= mdl{month{6}}));
+  static_assert( (mdl{month{10}} == mdl{month{10}}));
+  static_assert( (mdl{month{9}} != mdl{month{10}}));
+  static_assert( (mdl{month{8}} < mdl{month{10}}));
+  static_assert( (mdl{month{11}} > mdl{month{10}}));
+  static_assert( (mdl{month{10}} <= mdl{month{10}}));
+  static_assert( (mdl{month{10}} >= mdl{month{10}}));
+}
diff --git a/libstdc++-v3/testsuite/20_util/month_day_last/operations.cc b/libstdc++-v3/testsuite/20_util/month_day_last/operations.cc
new file mode 100644
index 00000000000..ba85f0df52e
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month_day_last/operations.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template month_day [time.cal.month_day]
+
+#include <chrono>
+
+constexpr void
+constexpr_month_day_last()
+{
+  using namespace std::chrono;
+  using mdl = month_day_last;
+
+  // Div ops...
+  static_assert(August/last == mdl{month{8}});
+  static_assert(8/last == mdl{month{8}});
+  static_assert(last/August == mdl{month{8}});
+  static_assert(last/8 == mdl{month{8}});
+}
diff --git a/libstdc++-v3/testsuite/20_util/month_weekday/1.cc b/libstdc++-v3/testsuite/20_util/month_weekday/1.cc
new file mode 100644
index 00000000000..d98bc5b52f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month_weekday/1.cc
@@ -0,0 +1,35 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.month_weekday]
+
+#include <chrono>
+
+constexpr void
+constexpr_month_weekday()
+{
+  using namespace std::chrono;
+  using mwd = month_weekday;
+
+  // mwd0 is the third Tuesday of February of an as yet unspecified year.
+  constexpr auto mwd0 = February / Tuesday[3];
+  static_assert(mwd0.month() == February);
+  static_assert(mwd0.weekday_indexed() == Tuesday[3]);
+}
diff --git a/libstdc++-v3/testsuite/20_util/month_weekday/operations.cc b/libstdc++-v3/testsuite/20_util/month_weekday/operations.cc
new file mode 100644
index 00000000000..4c4a14a2779
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month_weekday/operations.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.month_weekday]
+
+#include <chrono>
+
+constexpr void
+constexpr_month_weekday()
+{
+  using namespace std::chrono;
+  using mwd = month_weekday;
+
+  // Div ops...
+  static_assert(August/Friday[2] == mwd{month{8}, weekday_indexed{weekday{5u}, 2}});
+  static_assert(8/Friday[2] == mwd{month{8}, weekday_indexed{weekday{5u}, 2}});
+  static_assert(Friday[2]/August == mwd{month{8}, weekday_indexed{weekday{5u}, 2}});
+  static_assert(Friday[2]/8 == mwd{month{8}, weekday_indexed{weekday{5u}, 2}});
+}
diff --git a/libstdc++-v3/testsuite/20_util/month_weekday_last/1.cc b/libstdc++-v3/testsuite/20_util/month_weekday_last/1.cc
new file mode 100644
index 00000000000..8a05c2c963c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month_weekday_last/1.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.month_weekday_last]
+
+#include <chrono>
+
+constexpr void
+constexpr_month_weekday_last()
+{
+  using namespace std::chrono;
+  using mwdl = month_weekday;
+
+  // mwd0 is the third Tuesday of February of an as yet unspecified year.
+  constexpr auto mwdl0 = February / Tuesday[last];
+  static_assert(mwdl0.month() == February);
+  static_assert(mwdl0.weekday_last() == Tuesday[last]);
+
+}
diff --git a/libstdc++-v3/testsuite/20_util/month_weekday_last/operations.cc b/libstdc++-v3/testsuite/20_util/month_weekday_last/operations.cc
new file mode 100644
index 00000000000..7e4b7382547
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/month_weekday_last/operations.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.month_weekday_last]
+
+#include <chrono>
+
+constexpr void
+constexpr_month_weekday_last()
+{
+  using namespace std::chrono;
+  using mwdl = month_weekday_last;
+
+  // Div ops...
+  static_assert(August/Friday[last] == mwdl{month{8}, weekday_last{weekday{5u}}});
+  static_assert(8/Friday[last] == mwdl{month{8}, weekday_last{weekday{5u}}});
+  static_assert(Friday[last]/August == mwdl{month{8}, weekday_last{weekday{5u}}});
+  static_assert(Friday[last]/8 == mwdl{month{8}, weekday_last{weekday{5u}}});
+}
diff --git a/libstdc++-v3/testsuite/20_util/weekday/1.cc b/libstdc++-v3/testsuite/20_util/weekday/1.cc
new file mode 100644
index 00000000000..b780b4c8120
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/weekday/1.cc
@@ -0,0 +1,78 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.weekday]
+
+#include <chrono>
+
+constexpr void
+constexpr_weekday()
+{
+  using namespace std::chrono;
+
+  weekday dwd{};
+  ++dwd;
+  dwd++;
+  --dwd;
+  dwd--;
+  dwd += days{3};
+  dwd -= days{3};
+
+  static_assert(Monday + days{6} == Sunday);
+  static_assert(Sunday - Monday == days{6});
+/* Test 
+    constexpr
+    weekday(const sys_days& __dp) noexcept
+    : _M_wd(__from_days(__dp.time_since_epoch().count()))
+    { }
+
+    explicit constexpr
+    weekday(const local_days& __dp) noexcept
+    : _M_wd(__from_days(__dp.time_since_epoch().count()))
+    { }
+*/
+
+/* Test 
+    constexpr weekday_indexed
+    operator[](unsigned __index) const noexcept;
+
+    constexpr weekday_last
+    operator[](last_spec) const noexcept;
+*/
+  static_assert(weekday{3}[2].weekday() == weekday{3});
+  static_assert(weekday{3}[last].weekday() == weekday{3});
+
+  static_assert(++weekday{3} == weekday{4});
+  static_assert(weekday{3}++ == weekday{3});
+  static_assert(--weekday{3} == weekday{2});
+  static_assert(weekday{3}-- == weekday{3});
+  static_assert((weekday{3} += days{3}) == weekday{6});
+  static_assert((weekday{3} -= days{3}) == weekday{0});
+
+  static_assert(!weekday{127}.ok());
+  static_assert(weekday{0}.ok());
+  static_assert(weekday{6}.ok());
+  static_assert(weekday{7}.ok()); // Ctor wraps 7 to 0.
+  static_assert(!weekday{8}.ok());
+
+  static_assert(weekday{7} == weekday{0});
+  static_assert(!(weekday{0} == weekday{1}));
+  static_assert( (weekday{0} != weekday{2}));
+}
diff --git a/libstdc++-v3/testsuite/20_util/weekday_indexed/1.cc b/libstdc++-v3/testsuite/20_util/weekday_indexed/1.cc
new file mode 100644
index 00000000000..fb49ad6519e
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/weekday_indexed/1.cc
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.weekday_indexed]
+
+#include <chrono>
+
+constexpr void
+constexpr_weekday_indexed()
+{
+  using namespace std::chrono;
+
+  weekday_indexed dwdi{};
+
+  // wdi0 is the second Sunday of an as yet unspecified month.
+  constexpr auto wdi0 = Sunday[2];
+  static_assert(wdi0.weekday() == Sunday);
+  static_assert(wdi0.index() == 2);
+
+  constexpr auto wdl2 = weekday{3}[2];
+  static_assert(wdl2.weekday() == weekday{3});
+  static_assert(wdl2.index() == 2);
+
+  static_assert(!weekday_indexed{weekday{127}, 1}.ok());
+  static_assert(weekday_indexed{weekday{0}, 1}.ok());
+  static_assert(weekday_indexed{weekday{6}, 2}.ok());
+  static_assert(weekday_indexed{weekday{7}, 3}.ok()); // Weekday wraps 7 to 0.
+  static_assert(!weekday_indexed{weekday{8}, 1}.ok());
+  static_assert(!weekday_indexed{weekday{6}, 6}.ok());
+
+  static_assert(weekday{7} == weekday{0});
+  static_assert(!(weekday{0} == weekday{1}));
+  static_assert( (weekday{0} != weekday{2}));
+}
diff --git a/libstdc++-v3/testsuite/20_util/weekday_last/1.cc b/libstdc++-v3/testsuite/20_util/weekday_last/1.cc
new file mode 100644
index 00000000000..60269f99513
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/weekday_last/1.cc
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.weekday_last]
+
+#include <chrono>
+
+constexpr void
+constexpr_weekday_last()
+{
+  using namespace std::chrono;
+
+  constexpr auto wdl0 = Sunday[last];
+  static_assert(wdl0.weekday() == Sunday);
+
+  constexpr auto wdl1 = weekday{3}[2];
+  static_assert(wdl1.weekday() == weekday{3});
+  static_assert(wdl1.index() == 2);
+  constexpr auto wdll = weekday{3}[last];
+  static_assert(wdll.weekday() == weekday{3});
+
+  static_assert(!weekday_last{weekday{127}}.ok());
+  static_assert(weekday_last{weekday{0}}.ok());
+  static_assert(weekday_last{weekday{6}}.ok());
+  static_assert(weekday_last{weekday{7}}.ok()); // Weekday wraps 7 to 0.
+  static_assert(!weekday_last{weekday{8}}.ok());
+
+  static_assert( (weekday_last{weekday{7}} == weekday_last{weekday{0}}));
+  static_assert(!(weekday_last{weekday{0}} == weekday_last{weekday{1}}));
+  static_assert( (weekday_last{weekday{0}} != weekday_last{weekday{2}}));
+}
diff --git a/libstdc++-v3/testsuite/20_util/year/1.cc b/libstdc++-v3/testsuite/20_util/year/1.cc
new file mode 100644
index 00000000000..930d654ae28
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year/1.cc
@@ -0,0 +1,74 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.year]
+
+#include <chrono>
+
+constexpr void
+constexpr_year()
+{
+  using namespace std::chrono;
+
+  year dy{};
+  ++dy;
+  dy++;
+  --dy;
+  dy--;
+  dy += years{3};
+  dy -= years{3};
+
+  static_assert(++year{4} == year{5});
+  static_assert(year{4}++ == year{4});
+  static_assert(--year{4} == year{3});
+  static_assert(year{4}-- == year{4});
+  static_assert((year{4} += years{3}) == year{7});
+  static_assert((year{4} -= years{3}) == year{1});
+
+  const auto my = -dy;
+  const auto py = +dy;
+
+  static_assert((-year{1066} == year{-1066}));
+  static_assert((-year{-332} == year{332}));
+  static_assert((+year{1066} == year{1066}));
+  static_assert((+year{-332} == year{-332}));
+
+  year::min();
+  year::max();
+
+  static_assert(year{-12345}.ok());
+  static_assert(year{1}.ok());
+  static_assert(year{12}.ok());
+  static_assert(year{13}.ok());
+
+  static_assert(!(year{0} == year{1}));
+  static_assert( (year{0} != year{2}));
+  static_assert( (year{0} <  year{3}));
+  static_assert(!(year{0} >  year{4}));
+  static_assert( (year{0} <= year{5}));
+  static_assert(!(year{0} >= year{6}));
+
+  static_assert( year{400}.is_leap());
+  static_assert( year{1984}.is_leap());
+  static_assert(!year{1}.is_leap());
+  static_assert( year{1600}.is_leap());
+  static_assert(!year{3000}.is_leap());
+  static_assert(!year{2019}.is_leap());
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month/1.cc b/libstdc++-v3/testsuite/20_util/year_month/1.cc
new file mode 100644
index 00000000000..d090e42e33b
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month/1.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template year_month [time.cal.year_month]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month()
+{
+  using namespace std::chrono;
+  using ym = year_month;
+
+  ym ym0 = 2015y/April;
+
+  constexpr ym ym1 = {2015y, June};
+  static_assert(ym1.year() == year{2015});
+  static_assert(ym1.month() == June);
+  static_assert(ym1.ok());
+
+  constexpr ym ym2 = {2016y, May};
+  static_assert(ym2.year() == year{2016});
+  static_assert(ym2.month() == May);
+  static_assert(ym2.ok());
+
+  static_assert(ym1 == ym1);
+  static_assert(ym1 != ym2);
+  static_assert(ym1 < ym2);
+  static_assert(ym1 <= ym2);
+  static_assert(ym2 > ym1);
+  static_assert(ym2 >= ym2);
+
+  static_assert(ym2 - ym1 == months{11});
+  static_assert(ym1 - ym2 == -months{11});
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month/operations.cc b/libstdc++-v3/testsuite/20_util/year_month/operations.cc
new file mode 100644
index 00000000000..27b4019b24f
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month/operations.cc
@@ -0,0 +1,34 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template year_month [time.cal.year_month]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month()
+{
+  using namespace std::chrono;
+  using ym = year_month;
+
+  // Div ops...
+  static_assert(2015y/August == ym{year{2015}, August});
+  static_assert(2015y/8 == ym{year{2015}, August});
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month_day/1.cc b/libstdc++-v3/testsuite/20_util/year_month_day/1.cc
new file mode 100644
index 00000000000..d0efe580176
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month_day/1.cc
@@ -0,0 +1,49 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.year_month_day]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month_day()
+{
+  using namespace std::chrono;
+  using ymd = year_month_day;
+
+  static_assert(ymd{sys_days{2017y/January/0}}  == 2016y/December/31);
+  static_assert(ymd{sys_days{2017y/January/31}} == 2017y/January/31);
+  static_assert(ymd{sys_days{2017y/January/32}} == 2017y/February/1);
+
+  constexpr ymd ymd2{year{1984}, August, 3d};
+  static_assert(ymd2.year() == year{1984});
+  static_assert(ymd2.month() == August);
+  static_assert(ymd2.day() == 3d);
+  //static_assert(sys_days(ymd2) == time_point_cast<days>(days{5356}));
+  //static_assert(local_days(ymd2) == time_point_cast<days>(days{5356}));
+
+  // N.B. unix seems to be a macro somewhere!
+  constexpr ymd myunix = 1970y/1/1;
+  static_assert(myunix.year() == year{1970});
+  static_assert(myunix.month() == January);
+  static_assert(myunix.day() == day{1});
+  //static_assert(sys_days(myunix) == time_point_cast<days>(days{0}));
+  //static_assert(local_days(myunix) == time_point_cast<days>(days{0}));
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month_day/operations.cc b/libstdc++-v3/testsuite/20_util/year_month_day/operations.cc
new file mode 100644
index 00000000000..6f9137b9016
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month_day/operations.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.year_month_day]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month_day()
+{
+  using namespace std::chrono;
+  using ymd = year_month_day;
+
+  // Div ops...
+  static_assert(2015y/August/14d == ymd{year{2015}, month{8}, day{14}});
+  static_assert(2015y/August/14 == ymd{year{2015}, month{8}, day{14}});
+  static_assert(2015y/(August/14d) == ymd{year{2015}, month{8}, day{14}});
+  static_assert(2015/(August/14d) == ymd{year{2015}, month{8}, day{14}});
+  static_assert(August/14d/2015y == ymd{year{2015}, month{8}, day{14}});
+  static_assert(August/14d/2015 == ymd{year{2015}, month{8}, day{14}});
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month_day_last/1.cc b/libstdc++-v3/testsuite/20_util/year_month_day_last/1.cc
new file mode 100644
index 00000000000..09d6adba7fa
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month_day_last/1.cc
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.year_month_day_last]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month_day_last()
+{
+  using namespace std::chrono;
+  using mdl = month_day_last;
+  using ymdl = year_month_day_last;
+
+  year_month_day_last ymdl1{year{1066}, mdl{October}};
+  ymdl1 += months{9};
+  ymdl1 -= months{9};
+  ymdl1 += years{12};
+  ymdl1 -= years{12};
+
+  constexpr ymdl ymdl2{year{1984}, mdl{August}};
+  static_assert(ymdl2.year() == year{1984});
+  static_assert(ymdl2.month() == August);
+  static_assert(ymdl2.month_day_last() == mdl{August});
+  static_assert(ymdl2.day() == day{31});
+  //static_assert(sys_days(ymdl2).count() == 5356);
+  //static_assert(local_days(ymdl2).count() == 5356);
+
+  static_assert( (ymdl{year{1984}, mdl{August}}.ok()));
+  static_assert(!(ymdl{year{1984}, mdl{month{13}}}.ok()));
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month_day_last/operations.cc b/libstdc++-v3/testsuite/20_util/year_month_day_last/operations.cc
new file mode 100644
index 00000000000..9c4e6e3a3d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month_day_last/operations.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.year_month_day_last]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month_day_last()
+{
+  using namespace std::chrono;
+  using mdl = month_day_last;
+  using ymdl = year_month_day_last;
+
+  // Div ops...
+  static_assert(2015y/August/last == ymdl{year{2015}, month_day_last{month{8}}});
+  static_assert(2015y/(August/last) == ymdl{year{2015}, month_day_last{month{8}}});
+  static_assert(2015/(August/last) == ymdl{year{2015}, month_day_last{month{8}}});
+  static_assert(August/last/2015y == ymdl{year{2015}, month_day_last{month{8}}});
+  static_assert(August/last/2015 == ymdl{year{2015}, month_day_last{month{8}}});
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month_weekday/1.cc b/libstdc++-v3/testsuite/20_util/year_month_weekday/1.cc
new file mode 100644
index 00000000000..5354f9004e2
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month_weekday/1.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.year_month_weekday]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month_weekday()
+{
+  using namespace std::chrono;
+  using ymwd = year_month_weekday;
+
+  year_month_weekday ymwd1{};
+  ymwd1 += months{9};
+  ymwd1 -= months{9};
+  ymwd1 += years{12};
+  ymwd1 -= years{12};
+
+  constexpr ymwd ymwd2{year{1984}, month{August},
+		       weekday_indexed{Wednesday, 3}};
+  static_assert(ymwd2.year() == year{1984});
+  static_assert(ymwd2.month() == August);
+  static_assert(ymwd2.weekday() == Wednesday);
+  static_assert(ymwd2.index() == 3);
+  static_assert(ymwd2.weekday_indexed() == weekday_indexed{Wednesday, 3});
+
+  // N.B. unix seems to be a macro somewhere!
+  //constexpr ymwd myunix(local_days{0});
+  constexpr ymwd myunix{year{1970}, January, weekday_indexed{Thursday, 1}};
+  static_assert(myunix.year() == year{1970});
+  static_assert(myunix.month() == January);
+  static_assert(myunix.weekday() == Thursday);
+  static_assert(myunix.index() == 1);
+  static_assert(myunix.weekday_indexed() == weekday_indexed{Thursday, 1});
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month_weekday/operations.cc b/libstdc++-v3/testsuite/20_util/year_month_weekday/operations.cc
new file mode 100644
index 00000000000..029d324e31c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month_weekday/operations.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template day [time.cal.year_month_weekday]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month_weekday()
+{
+  using namespace std::chrono;
+  using ymwd = year_month_weekday;
+
+  // Div operations...
+  static_assert(2015y/August/Friday[2] == ymwd{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}});
+  static_assert(2015y/(August/Friday[2]) == ymwd{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}});
+  static_assert(2015/(August/Friday[2]) == ymwd{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}});
+  static_assert(August/Friday[2]/2015y == ymwd{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}});
+  static_assert(August/Friday[2]/2015 == ymwd{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}});
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month_weekday_last/1.cc b/libstdc++-v3/testsuite/20_util/year_month_weekday_last/1.cc
new file mode 100644
index 00000000000..f0e3a30c092
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month_weekday_last/1.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template month_day [time.cal.month_day]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month_weekday_last()
+{
+  using namespace std::chrono;
+  using ymwdl = year_month_weekday_last;
+
+  constexpr ymwdl ymwdl1 = {2015y, August, weekday_last{Friday}};
+  static_assert(ymwdl1.ok());
+  static_assert(ymwdl1.year() == 2015y);
+  static_assert(ymwdl1.month() == August);
+  static_assert(ymwdl1.weekday() == Friday);
+  static_assert(ymwdl1.weekday_last() == Friday[last]);
+  constexpr sys_days dp = ymwdl1;
+  constexpr year_month_day ymd = dp;
+  static_assert(ymd == 2015y/August/28);
+
+  //constexpr ymwdl ymwdl2 = Saturday[last]/August/2015y;
+
+  static_assert(ymwdl1 == ymwdl1);
+  //static_assert(ymwdl1 != ymwdl2);
+}
diff --git a/libstdc++-v3/testsuite/20_util/year_month_weekday_last/operations.cc b/libstdc++-v3/testsuite/20_util/year_month_weekday_last/operations.cc
new file mode 100644
index 00000000000..523b51f4d80
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/year_month_weekday_last/operations.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Class template month_day [time.cal.month_day]
+
+#include <chrono>
+
+constexpr void
+constexpr_year_month_weekday_last()
+{
+  using namespace std::chrono;
+  using ymwdl = year_month_weekday_last;
+
+  // Div operations...
+  static_assert(2015y/August/Friday[last] == ymwdl{year{2015}, month{8}, weekday_last{weekday{5u}}});
+  static_assert(2015y/(August/Friday[last]) == ymwdl{year{2015}, month{8}, weekday_last{weekday{5u}}});
+  static_assert(2015/(August/Friday[last]) == ymwdl{year{2015}, month{8}, weekday_last{weekday{5u}}});
+  //static_assert(August/Friday[last]/2015y == ymwdl{year{2015}, month{8}, weekday_last{weekday{5u}}});
+  //static_assert(August/Friday[last]/2015 == ymwdl{year{2015}, month{8}, weekday_last{weekday{5u}}});
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-11 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 14:17 [gcc(refs/users/redi/heads/calendar)] Ed's work on calendar types Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).