aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-08-26 12:45:02 -0400
committerPatrick Palka <ppalka@redhat.com>2020-08-26 12:58:37 -0400
commit0c5df67ffcf421b8c532513a655a37839e632710 (patch)
tree787ba5e69611823d43c97c77c1a1d2bc85bf0038
parent9f9c0549dd42e85e2500ca67cef89dddb142c0c7 (diff)
downloadgcc-0c5df67ffcf421b8c532513a655a37839e632710.zip
gcc-0c5df67ffcf421b8c532513a655a37839e632710.tar.gz
gcc-0c5df67ffcf421b8c532513a655a37839e632710.tar.bz2
libstdc++: Fix typo in chrono::year_month_weekday::operator==
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.
-rw-r--r--libstdc++-v3/include/std/chrono2
-rw-r--r--libstdc++-v3/testsuite/std/time/year_month_weekday/1.cc5
2 files changed, 6 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 3cc1438..01f1e2d 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -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
diff --git a/libstdc++-v3/testsuite/std/time/year_month_weekday/1.cc b/libstdc++-v3/testsuite/std/time/year_month_weekday/1.cc
index 3781f17..6924f94 100644
--- a/libstdc++-v3/testsuite/std/time/year_month_weekday/1.cc
+++ b/libstdc++-v3/testsuite/std/time/year_month_weekday/1.cc
@@ -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());