[libcxx-commits] [libcxx] [NFC][libc++] Removes Clang 16 work-arounds. (PR #91636)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 9 11:04:48 PDT 2024


https://github.com/mordante created https://github.com/llvm/llvm-project/pull/91636

This was noticed while reviewing the implementation status of
  P1614R2 The Mothership has Landed

Drive-by: Add some missing _LIBCPP_HIDE_FROM_ABIs.

>From 13b0d1449be365f35e0041549b061385bd68a529 Mon Sep 17 00:00:00 2001
From: Mark de Wever <koraq at xs4all.nl>
Date: Thu, 9 May 2024 19:46:37 +0200
Subject: [PATCH] [NFC][libc++] Removes Clang 16 work-arounds.

This was noticed while reviewing the implementation status of
  P1614R2 The Mothership has Landed

Drive-by: Add some missing _LIBCPP_HIDE_FROM_ABIs.
---
 libcxx/include/queue |  7 +++++--
 libcxx/include/stack | 13 +++++++++----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libcxx/include/queue b/libcxx/include/queue
index 8d6f6c667b93b..893cfb29d18e8 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -425,6 +425,10 @@ public:
   template <class _T1, class _OtherContainer>
   friend _LIBCPP_HIDE_FROM_ABI bool
   operator<(const queue<_T1, _OtherContainer>& __x, const queue<_T1, _OtherContainer>& __y);
+
+  template <class _T1, three_way_comparable _OtherContainer>
+  friend _LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_OtherContainer>
+  operator<=>(const queue<_T1, _OtherContainer>& __x, const queue<_T1, _OtherContainer>& __y);
 };
 
 #if _LIBCPP_STD_VER >= 17
@@ -494,8 +498,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const queue<_Tp, _Container>& __x,
 template <class _Tp, three_way_comparable _Container>
 _LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_Container>
 operator<=>(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
-  // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
-  return __x.__get_container() <=> __y.__get_container();
+  return __x.c <=> __y.c;
 }
 
 #endif
diff --git a/libcxx/include/stack b/libcxx/include/stack
index e45bfba5587ed..6a4214b0fe555 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -276,10 +276,16 @@ public:
   _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
 
   template <class _T1, class _OtherContainer>
-  friend bool operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
+  friend _LIBCPP_HIDE_FROM_ABI bool
+  operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
 
   template <class _T1, class _OtherContainer>
-  friend bool operator<(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
+  friend _LIBCPP_HIDE_FROM_ABI bool
+  operator<(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
+
+  template <class _T1, three_way_comparable _OtherContainer>
+  friend _LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_OtherContainer>
+  operator<=>(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
 };
 
 #if _LIBCPP_STD_VER >= 17
@@ -348,8 +354,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const stack<_Tp, _Container>& __x,
 template <class _Tp, three_way_comparable _Container>
 _LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_Container>
 operator<=>(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
-  // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
-  return __x.__get_container() <=> __y.__get_container();
+  return __x.c <=> __y.c;
 }
 
 #endif



More information about the libcxx-commits mailing list