[Bug libstdc++/63500] [4.9/5 Regression] bug in debug version of std::make_move_iterator?

François Dumont frs.dumont@gmail.com
Wed Oct 15 20:06:00 GMT 2014


On 15/10/2014 13:10, Jonathan Wakely wrote:
>
> I find this much easier to read:
>
> #if __cplusplus < 201103L
>      typedef _Is_contiguous_sequence<_Sequence> __tag;
> #else
>      using __lvalref = std::is_lvalue_reference<
>        typename std::iterator_traits<_InputIterator>::reference>;
>      using __contiguous = _Is_contiguous_sequence<_Sequence>;
>      using __tag = typename std::conditional<__lvalref::value, 
> __contiguous,
> std::__false_type>::type;
> #endif
>      return __foreign_iterator_aux3(__it, __other, __other_end, __tag());
>
> It only has one preprocessor condition and it avoids mismatched
> parentheses caused by opening the function parameter list once but
> closing it twice in two different branches.
>
>
That's much better indeed.

     Shall we go with this ? Of course we are simply considering that we 
can't check for foreign iterators when some iterator adapters comes 
in-between. I hope one day to detect invalid usages even in this context.

2014-10-16  François Dumont  <fdumont@gcc.gnu.org>

     PR libstdc++/63500
     * include/debug/functions.h (__foreign_iterator_aux2): Do not check for
     foreign iterators if input iterators returns rvalue reference.
     * testsuite/23_containers/vector/63500.cc: New.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug.patch
Type: text/x-patch
Size: 2737 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20141015/51f3bf39/attachment.bin>


More information about the Libstdc++ mailing list