public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testbase)] libstdc++: Fix typo in chrono::year_month_weekday::operator==
Date: Thu,  3 Sep 2020 15:50:26 +0000 (GMT)	[thread overview]
Message-ID: <20200903155026.64D0E3985837@sourceware.org> (raw)

https://gcc.gnu.org/g:0c5df67ffcf421b8c532513a655a37839e632710

commit 0c5df67ffcf421b8c532513a655a37839e632710
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Aug 26 12:45:02 2020 -0400

    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.

Diff:
---
 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 3cc1438a7b6..01f1e2d2b71 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 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());


                 reply	other threads:[~2020-09-03 15:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200903155026.64D0E3985837@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).