<div dir="ltr">It's worth noting that somebody tried to remove many supposedly-redundant std::move calls (see <a href="https://github.com/llvm/llvm-project/commit/1c2241a7936bf85aa68aef94bd40c3ba77d8ddf2#diff-7046c45834a9a01f5ea1571c64d347bb">https://github.com/llvm/llvm-project/commit/1c2241a7936bf85aa68aef94bd40c3ba77d8ddf2#diff-7046c45834a9a01f5ea1571c64d347bb</a>), but this broke most or all the build bots, presumably because of reasons as outlined, so was reverted.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 16 Feb 2020 at 14:07, Whisperity via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I apologise, I wrote the example out of my mind without exact details - I just remembered that there *are* issues with adding/removing move when you want to target multiple compilers. It could be, that in the GCC line it works, but older Clangs don't support it, maybe you need two layers of template instantiation or return value wrapping for this to break. It's been a while since I had the exact case in front of me.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Mehdi AMINI <<a href="mailto:joker.eph@gmail.com" target="_blank">joker.eph@gmail.com</a>> ezt írta (időpont: 2020. febr. 15., Szo, 21:42):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 15, 2020 at 12:13 PM Whisperity via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>You cannot really *fix* the issue until the minimum required GCC version for the project is bumped because changing "std::move(Err)" to just "Err" may (and most likely will) result in compile errors. The following case:</div><div><br></div><div>  struct Something {};<br></div><div>  <T> struct CreateFromMoveable {</div><div>    CreateFromMoveable(T&&);</div><div>  };</div><div><br></div><div>  CreateFromMoveable<Something> f() {</div><div>    Something S;</div><div>    // ...</div><div>    return S;</div><div>  }</div><div><br></div><div>is a hard failure with old GCC, that's why "std::move" is written there. Once the "std::move" is there, old GCC properly picks up the fact that it could bind the move ctor in the return.</div></div></blockquote><div><br></div><div>Seems like this was fixed in gcc5?</div><div><br></div><div><a href="https://godbolt.org/z/zaDyt6" target="_blank">https://godbolt.org/z/zaDyt6</a><br></div><div><br></div><div>-- </div><div>Mehdi</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>For now, you could either fall back to using an older compiler or disable the warning locally...</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Nicolai Hähnle via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> ezt írta (időpont: 2020. febr. 15., Szo, 20:35):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br>
<br>
GCC 9 introduced a new warning, -Wredundant-move, which is enabled by<br>
default when building LLVM and produces what looks like at least<br>
thousands of hits.<br>
<br>
<a href="https://reviews.llvm.org/D74672" rel="noreferrer" target="_blank">https://reviews.llvm.org/D74672</a> is a sample of the kind of changes<br>
pointed out by this warning, more explanations are in this blog post:<br>
<a href="https://developers.redhat.com/blog/2019/04/12/understanding-when-not-to-stdmove-in-c/" rel="noreferrer" target="_blank">https://developers.redhat.com/blog/2019/04/12/understanding-when-not-to-stdmove-in-c/</a><br>
<br>
What do people think should be done here?<br>
<br>
1. Disable -Wredundant-move?<br>
2. Fix it all (seems daunting to do manually)?<br>
3. Encourage clang/clang-tidy developers to add this warning and add a<br>
clang-tidy rule to fix it automatically?<br>
<br>
My personal opinion is that while the review linked above should be<br>
committed, it's ultimately a drop in the ocean and #3 is the way to<br>
go.<br>
<br>
In the meantime, I'm certainly going to disable -Wredundant-move<br>
locally, but should that also be done by default for gcc in the<br>
CMakeLists.txt?<br>
<br>
Cheers,<br>
Nicolai<br>
-- <br>
Lerne, wie die Welt wirklich ist,<br>
aber vergiss niemals, wie sie sein sollte.<br>
_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>
_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div></div>
</blockquote></div>
_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>