<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:eric@efcs.ca" title="Eric Fiselier <eric@efcs.ca>"> <span class="fn">Eric Fiselier</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - iter_swap() shouldn't have an exception specification"
href="https://bugs.llvm.org/show_bug.cgi?id=28559">bug 28559</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - iter_swap() shouldn't have an exception specification"
href="https://bugs.llvm.org/show_bug.cgi?id=28559#c7">Comment # 7</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - iter_swap() shouldn't have an exception specification"
href="https://bugs.llvm.org/show_bug.cgi?id=28559">bug 28559</a>
from <span class="vcard"><a class="email" href="mailto:eric@efcs.ca" title="Eric Fiselier <eric@efcs.ca>"> <span class="fn">Eric Fiselier</span></a>
</span></b>
<pre>Your iter_swap overload doesn't meet the requirements of C++1z [alg.swap]/p5:
<span class="quote">> template<class ForwardIterator1, class ForwardIterator2>
> void iter_swap(ForwardIterator1 a, ForwardIterator2 b);
> Requires: a and b shall be dereferenceable. *a shall be swappable
> with (20.5.3.2) *b.</span >
That requires your IntProxy type to be swappable, which it is not. violating
the function preconditions, and according to [res.on.required]:
<span class="quote">> Violation of the preconditions specified in a function’s
> Requires: paragraph results in undefined behavior
> unless the function’s Throws: paragraph specifies throwing
> an exception when the precondition is violated.</span >
Additionally your specialization is not immune to the requirements specified in
the standard. See [namespace.std]
<span class="quote">> A program may add a template specialization for any standard library
> template to namespace std only if [...] the specialization meets the
> standard library requirements for the original template and is not
> explicitly prohibited.</span >
In summary your example has undefined behavior because IntProxy type returned
from the iterator isn't swappable and that violates the requirements for
iter_swap.
Feel free to reopen if you disagree or if I was unclear.</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>