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

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 8 10:10:15 PDT 2025


Author: Mark de Wever
Date: 2025-04-08T19:10:11+02:00
New Revision: 6d2b767678caac108eeac752b0b90c98a44107ee

URL: https://github.com/llvm/llvm-project/commit/6d2b767678caac108eeac752b0b90c98a44107ee
DIFF: https://github.com/llvm/llvm-project/commit/6d2b767678caac108eeac752b0b90c98a44107ee.diff

LOG: [NFC][libc++] Removes Clang 16 work-arounds. (#91636)

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

Drive-by: Add some missing _LIBCPP_HIDE_FROM_ABIs.

Added: 
    

Modified: 
    libcxx/include/queue
    libcxx/include/stack

Removed: 
    


################################################################################
diff  --git a/libcxx/include/queue b/libcxx/include/queue
index ff69d75591deb..5bdc0e7e01dd0 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -428,6 +428,12 @@ public:
   template <class _T1, class _OtherContainer>
   friend _LIBCPP_HIDE_FROM_ABI bool
   operator<(const queue<_T1, _OtherContainer>& __x, const queue<_T1, _OtherContainer>& __y);
+
+#  if _LIBCPP_STD_VER >= 20
+  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);
+#  endif
 };
 
 #  if _LIBCPP_STD_VER >= 17
@@ -497,8 +503,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 3ff3df2c9650f..c5cbfc9bf6e65 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -279,10 +279,18 @@ public:
   [[__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);
+
+#  if _LIBCPP_STD_VER >= 20
+  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);
+#  endif
 };
 
 #  if _LIBCPP_STD_VER >= 17
@@ -353,8 +361,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