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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
   Last reconfirmed|                            |2023-08-06
   Target Milestone|---                         |13.3
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Arthur O'Dwyer from comment #0)
> libc++ and Microsoft are both completely happy with this code. libstdc++ is
> happy with `f` but unhappy with `g`. I suspect that someplace is accepting
> "contiguous iterators of any old T" when it means to limit itself to
> "contiguous iterators of char" specifically.

Indeed, it's fixed by:

   // not introduce any invalid pointer arithmetic or overflows that would not
   // have happened anyway.
   template<typename _CharT, contiguous_iterator _OutIter>
+    requires same_as<iter_value_t<_OutIter>, _CharT>
     class _Iter_sink<_CharT, _OutIter> : public _Sink<_CharT>
     {
       using uint64_t = __UINTPTR_TYPE__;

Alternatively, we could replace the contiguous_iterator<_OutIter> constraint
with constructible_from<span<_CharT>, _OutIter, iter_difference_t<_OutIter>>.

Reply via email to