public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3891] libstdc++: Fix tests with non-const operator==
@ 2022-11-11  5:29 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-11-11  5:29 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

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;
 };

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-11  5:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11  5:29 [gcc r13-3891] libstdc++: Fix tests with non-const operator== 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).