public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Fix typo in chrono::year_month_weekday::operator==
@ 2020-08-26 16:35 Patrick Palka
  2020-08-26 16:39 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Palka @ 2020-08-26 16:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Patrick Palka

Tested on x86_64-pc-linux-gnu, does this look OK to commit?

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                         | 2 +-
 libstdc++-v3/testsuite/std/time/year_month_weekday/1.cc | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 46086140d9d..417954d103b 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -2657,7 +2657,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
 	return __x.year() == __y.year()
 	  && __x.month() == __y.month()
-	  && __x.weekday() == __y.weekday();
+	  && __x.weekday_indexed() == __y.weekday_indexed();
       }
 
       template<typename = __detail::__months_years_conversion_disambiguator>
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 3781f1781b7..6924f947210 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());
-- 
2.28.0.337.ge9b77c84a0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libstdc++: Fix typo in chrono::year_month_weekday::operator==
  2020-08-26 16:35 [PATCH] libstdc++: Fix typo in chrono::year_month_weekday::operator== Patrick Palka
@ 2020-08-26 16:39 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2020-08-26 16:39 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gcc-patches, libstdc++

On 26/08/20 12:35 -0400, Patrick Palka via Libstdc++ wrote:
>Tested on x86_64-pc-linux-gnu, does this look OK to commit?

OK, thanks.


>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                         | 2 +-
> libstdc++-v3/testsuite/std/time/year_month_weekday/1.cc | 5 +++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
>diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
>index 46086140d9d..417954d103b 100644
>--- a/libstdc++-v3/include/std/chrono
>+++ b/libstdc++-v3/include/std/chrono
>@@ -2657,7 +2657,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>       {
> 	return __x.year() == __y.year()
> 	  && __x.month() == __y.month()
>-	  && __x.weekday() == __y.weekday();
>+	  && __x.weekday_indexed() == __y.weekday_indexed();
>       }
>
>       template<typename = __detail::__months_years_conversion_disambiguator>
>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 3781f1781b7..6924f947210 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());
>-- 
>2.28.0.337.ge9b77c84a0
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-26 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 16:35 [PATCH] libstdc++: Fix typo in chrono::year_month_weekday::operator== Patrick Palka
2020-08-26 16:39 ` 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).