<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - iter_swap() shouldn't have an exception specification"
href="https://llvm.org/bugs/show_bug.cgi?id=28559">28559</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>iter_swap() shouldn't have an exception specification
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vz-llvm@zeitlins.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>