public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-3891] libstdc++: Fix tests with non-const operator==
Date: Fri, 11 Nov 2022 05:29:59 +0000 (GMT)	[thread overview]
Message-ID: <20221111052959.69F883848581@sourceware.org> (raw)

https://gcc.gnu.org/g:fbad7a74aaaddea3d7b39045a09dd3860603658e

commit r13-3891-gfbad7a74aaaddea3d7b39045a09dd3860603658e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 10 14:11:27 2022 +0000

    libstdc++: Fix tests with non-const operator==
    
    These tests fail in strict -std=c++20 mode but their equality ops don't
    need to be non-const, it looks like an accident.
    
    This fixes two FAILs with -std=c++20:
    FAIL: 20_util/tuple/swap.cc (test for excess errors)
    FAIL: 26_numerics/valarray/87641.cc (test for excess errors)
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/20_util/tuple/swap.cc (MoveOnly::operator==): Add
            const qualifier.
            * testsuite/26_numerics/valarray/87641.cc (X::operator==):
            Likewise.

Diff:
---
 libstdc++-v3/testsuite/20_util/tuple/swap.cc         | 2 +-
 libstdc++-v3/testsuite/26_numerics/valarray/87641.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/20_util/tuple/swap.cc b/libstdc++-v3/testsuite/20_util/tuple/swap.cc
index c086a4f1a8e..30c8322f01c 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/swap.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/swap.cc
@@ -38,7 +38,7 @@ struct MoveOnly
   MoveOnly(MoveOnly const&) = delete;
   MoveOnly& operator=(MoveOnly const&) = delete;
 
-  bool operator==(MoveOnly const& m)
+  bool operator==(MoveOnly const& m) const
   { return i == m.i; }
 
   void swap(MoveOnly& m)
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc b/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc
index 38c35851716..4a6e402831d 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc
@@ -39,7 +39,7 @@ struct X
   X() : val(1) { }
 
   X& operator+=(const X& x) { val += x.val; return *this; }
-  bool operator==(const X& x) { return val == x.val; }
+  bool operator==(const X& x) const { return val == x.val; }
 
   int val;
 };

                 reply	other threads:[~2022-11-11  5:29 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=20221111052959.69F883848581@sourceware.org \
    --to=redi@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).