<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">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color: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">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-width:1px;border-left-style:solid;border-left-color: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-width:1px;border-left-style:solid;border-left-color: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>