libstdc++: Fix typo in chrono::year_month_weekday::operator==
authorPatrick Palka <ppalka@redhat.com>
Wed, 26 Aug 2020 16:45:02 +0000 (12:45 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 26 Aug 2020 16:58:37 +0000 (12:58 -0400)
libstdc++-v3/ChangeLog:

* include/std/chrono (year_month_weekday::operator==): Compare
weekday_indexed instead of weekday.
* testsuite/std/time/year_month_weekday/1.cc: Augment testcase.

libstdc++-v3/include/std/chrono
libstdc++-v3/testsuite/std/time/year_month_weekday/1.cc

index 3cc1438a7b6242c82ddffe54f628717e3c7cb14d..01f1e2d2b71aa7783bdf8bbec04a97b77b1c1eb0 100644 (file)
@@ -2623,7 +2623,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
        return __x.year() == __y.year()
          && __x.month() == __y.month()
-         && __x.weekday() == __y.weekday();
+         && __x.weekday_indexed() == __y.weekday_indexed();
       }
 
       friend constexpr year_month_weekday
index 3781f1781b768c963380b860bc4cbb1d06a2dba6..6924f94721082c3d793c3f86e9e606f6f76220c9 100644 (file)
@@ -58,6 +58,11 @@ constexpr_year_month_weekday()
   static_assert(years{1} + January/Tuesday[2]/1900y == January/Tuesday[2]/1901y);
   static_assert(January/Tuesday[2]/1900y - years{1} == January/Tuesday[2]/1899y);
 
+  static_assert(January/Tuesday[1]/1900y != February/Tuesday[1]/1900y);
+  static_assert(January/Tuesday[1]/1900y != January/Wednesday[1]/1900y);
+  static_assert(January/Tuesday[1]/1900y != January/Tuesday[1]/1901y);
+  static_assert(January/Tuesday[1]/1900y != January/Tuesday[2]/1900y);
+
   // N.B. unix seems to be a macro somewhere!
   constexpr ymwd myunix(local_days{days{0}});
   static_assert(myunix.ok());