[committed] libstdc++: Fix access error in __gnu_test::uneq_allocator

Message ID 20231123174450.2450203-1-jwakely@redhat.com
State Accepted
Headers
Series [committed] libstdc++: Fix access error in __gnu_test::uneq_allocator |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jonathan Wakely Nov. 23, 2023, 5:44 p.m. UTC
  Tested x86_64-linux. Pushed to trunk.

-- >8 --

The operator== function is only a friend of the LHS argument, so cannot
access the private member of the RHS argument. Use the public accessor
instead.

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_allocator.h (uneq_allocator): Fix
	equality operator for heterogeneous comparisons.
---
 libstdc++-v3/testsuite/util/testsuite_allocator.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index 70dacb3fdf2..1773b723b66 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -418,7 +418,7 @@  namespace __gnu_test
 	operator==(const uneq_allocator& a,
 		   const uneq_allocator<Tp1,
 		   typename AllocTraits::template rebind<Tp1>::other>& b)
-	{ return a.personality == b.personality; }
+	{ return a.personality == b.get_personality(); }
 
       template<typename Tp1>
 	friend inline bool