<div dir="ltr">Looks like libstdc++ fixed this 3 years ago: <a href="https://gcc.gnu.org/r224153">https://gcc.gnu.org/r224153</a><div><br></div><div>/Eric</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 18, 2018 at 3:01 AM, Liu Hao via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">在 2018/5/18 0:09, Lucas Czech via cfe-dev 写道:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Error message:<br>
<br>
|/usr/bin/../lib/gcc/x86_64-li<wbr>nux-gnu/4.9/../../../../includ<wbr>e/c++/4.9/debug/array:86:52: <br>
</blockquote>
<br></span>
This is a libstdc++ header, so it cannot be a libc++ bug.<br>
<br>
It is however a clang bug. See below.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
The issue was discussed here: <a href="https://github.com/greg7mdp/sparsepp/issues/61" rel="noreferrer" target="_blank">https://github.com/greg7mdp/sp<wbr>arsepp/issues/61</a><br></span>
where greg7mdp <<a href="https://github.com/greg7mdp" rel="noreferrer" target="_blank">https://github.com/greg7mdp</a>> suggested that the problem might be a missing `std` in front of the swap() call:<br>
<br>
</blockquote>
<br>
It might resolve the issue but is not a correct solution.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
|void swap(array& __other) noexcept(noexcept(_*std::*_swa<wbr>p(std::declval<_Tp&>(), std::declval<_Tp&>()))) { std::swap_ranges(begin(), end(), __other.begin()); }|<br>
<br>
<br>
</blockquote>
<br>
The second, unqualified `swap` is envisioned to involve the Argument Dependent Lookup (ADL) and call whatever ADL finds, and if ADL fails to find (a most probably user-defined) one, call the one in `std`.<br>
<br>
Here clang behaves as if the second `swap` is hidden by the first one being declared. This is the bug, because the exception specification is part of the function declarator and is before the point of declaration of the function being declared, and consequently, shall not make the name of the function in question visible.<br>
<br>
The use of the qualified name `std::swap` prevents the second `swap` from being hidden as described above, but it also forbids ADL so user-defined `swap` functions cannot be found at all. This is a minor issue if you have had move assignment operators implemented properly, nevertheless.<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Please let me know if this is a bug in libc++, or an issue with sparsepp, where the problem manifests.<br>
<br>
Thanks<br>
Lucas<br>
<br>
</blockquote>
<br>
<br>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Best regards,<br>
LH_Mouse<br>
<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote></div><br></div>