https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93960

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-02-28
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This seems to work:

--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -35,6 +35,9 @@
 #include <debug/safe_base.h>
 #include <bits/stl_pair.h>
 #include <ext/type_traits.h>
+#if __cplusplus > 201703L
+# include <concepts>
+#endif

 #define _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, _BadMsgId, _DiffMsgId) \
   _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular(),    \
@@ -952,6 +955,13 @@ namespace __gnu_debug
     __unsafe(const _Safe_iterator<_Iterator, _Sequence>& __it)
     { return __it.base(); }

+#if __cplusplus > 201703L && __cpp_lib_concepts
+  template<std::derived_from<_Safe_iterator_base> _Iter>
+    constexpr auto
+    __to_address(const _Iter& __iter) noexcept
+    { return std::__to_address(__iter.operator->()); }
+#endif
+
 } // namespace __gnu_debug

 #undef _GLIBCXX_DEBUG_VERIFY_DIST_OPERANDS


This overload is more constrained than the existing ones, so gets chosen by
overload resolution.

Reply via email to