]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: add ADL friends
authorJason Merrill <jason@redhat.com>
Sat, 1 Nov 2025 13:07:18 +0000 (16:07 +0300)
committerJason Merrill <jason@redhat.com>
Mon, 3 Nov 2025 18:32:25 +0000 (21:32 +0300)
Since the implementation namespaces __detail and __exception_ptr aren't
exported from std, ADL can't find these functions there.  Adding friend
declarations makes it work.

libstdc++-v3/ChangeLog:

* include/bits/quoted_string.h: Add ADL friends.
* libsupc++/exception_ptr.h: Add ADL friend.

libstdc++-v3/include/bits/quoted_string.h
libstdc++-v3/libsupc++/exception_ptr.h

index 3a828d5eab947489dafeb757318ee7e32605a9cd..9a51aa367fe51d80925cef6613e44879496d1cec 100644 (file)
@@ -61,6 +61,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        _Quoted_string&
        operator=(_Quoted_string&) = delete;
 
+       // Friends for ADL with module std.
+       template<typename _CharT2, typename _Traits>
+       friend std::basic_ostream<_CharT2, _Traits>&
+       operator<<(std::basic_ostream<_CharT2, _Traits>& __os,
+                  const _Quoted_string<const _CharT2*, _CharT2>& __str);
+
+       template<typename _CharT2, typename _Traits, typename _String2>
+       friend std::basic_ostream<_CharT2, _Traits>&
+       operator<<(std::basic_ostream<_CharT2, _Traits>& __os,
+                  const _Quoted_string<_String2, _CharT2>& __str);
+
+       template<typename _CharT2, typename _Traits, typename _Alloc>
+       friend std::basic_istream<_CharT2, _Traits>&
+       operator>>(std::basic_istream<_CharT2, _Traits>& __is,
+                  const _Quoted_string<basic_string<_CharT2, _Traits, _Alloc>&,
+                  _CharT2>& __str);
+
        _String _M_string;
        _CharT _M_delim;
        _CharT _M_escape;
@@ -78,6 +95,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        _Quoted_string&
        operator=(_Quoted_string&) = delete;
 
+       // Friend for ADL with module std.
+       template<typename _CharT2, typename _Traits2, typename _String2>
+       friend std::basic_ostream<_CharT2, _Traits2>&
+       operator<<(std::basic_ostream<_CharT2, _Traits2>& __os,
+                  const _Quoted_string<_String2, _CharT2>& __str);
+
        basic_string_view<_CharT, _Traits> _M_string;
        _CharT _M_delim;
        _CharT _M_escape;
index f673a334333864de1cb65eb3e6ff7464270f3b3d..76482db3756594169eee15c0477ba5e18f4e7b42 100644 (file)
@@ -214,6 +214,10 @@ namespace std _GLIBCXX_VISIBILITY(default)
       { return __x._M_exception_object != __y._M_exception_object; }
 #endif
 
+      // Friend for ADL with module std.
+      friend _GLIBCXX26_CONSTEXPR void
+      swap(exception_ptr& __lhs, exception_ptr& __rhs);
+
       const class std::type_info*
       __cxa_exception_type() const _GLIBCXX_USE_NOEXCEPT
        __attribute__ ((__pure__));