Skip to content
Snippets Groups Projects
Commit fbad7a74 authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

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.
parent f54ae4da
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ struct MoveOnly ...@@ -38,7 +38,7 @@ struct MoveOnly
MoveOnly(MoveOnly const&) = delete; MoveOnly(MoveOnly const&) = delete;
MoveOnly& operator=(MoveOnly const&) = delete; MoveOnly& operator=(MoveOnly const&) = delete;
bool operator==(MoveOnly const& m) bool operator==(MoveOnly const& m) const
{ return i == m.i; } { return i == m.i; }
void swap(MoveOnly& m) void swap(MoveOnly& m)
......
...@@ -39,7 +39,7 @@ struct X ...@@ -39,7 +39,7 @@ struct X
X() : val(1) { } X() : val(1) { }
X& operator+=(const X& x) { val += x.val; return *this; } 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; int val;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment