https://llvm.org/bugs/show_bug.cgi?id=28559

            Bug ID: 28559
           Summary: iter_swap() shouldn't have an exception specification
           Product: libc++
           Version: 3.7
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: vz-l...@zeitlins.org
                CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com
    Classification: Unclassified

I could be wrong, but I think that iter_swap() shouldn't have any exception
specification because it doesn't appear in the standard (nor in libstdc++ nor
MSVC standard library) and so its presence in libc++ where it's defined, in my
copy of /usr/include/c++/v1/type_traits as

template <class _ForwardIterator1, class _ForwardIterator2>
inline _LIBCPP_INLINE_VISIBILITY
void
iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
    //                                  _NOEXCEPT_(_NOEXCEPT_(swap(*__a,
*__b)))
               _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(),
                                         
*_VSTD::declval<_ForwardIterator2>())))
{ ... }

makes it impossible to write portable code specializing iter_swap() as it needs
to use the noexcept() specification above for libc++ and for libc++ only, e.g.
the same code can't compile even when using the same clang compiler for both
-stdlib=libc++ and -stdlib=libstdc++.

Moreover, in my particular case, I specialize iter_swap() in the first place
because swap() can't be used for my iterator type as iterator::reference is a
proxy object and not iterator::value_type&, so the swap() call inside
noexcept() above doesn't compile and makes it completely impossible to use
iter_swap() with this iterator AFAICS.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to