[llvm-bugs] [Bug 28559] New: iter_swap() shouldn't have an exception specification
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 14 17:02:27 PDT 2016
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: unassignedclangbugs at nondot.org
Reporter: vz-llvm at zeitlins.org
CC: llvm-bugs at lists.llvm.org, mclow.lists at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160715/71e2a0e6/attachment.html>
More information about the llvm-bugs
mailing list