<div dir="ltr">For the case of a redundant or unneeded std::move, I think Clang already has something like that... <br><br>Ah, it doesn't quite catch that particular case.<br><br>Richard - would it be reasonable to extend the pessimizing move warning (well, I guess not - maybe as a separate warning) for cases like this:<br><br>void f(const foo&);<br>void g(foo x) {<br> f(std::move(x));<br>}<br><br>Or maybe there's already a clang-tidy check for this sort of redundant move?<br><br><div class="gmail_quote"><div dir="ltr">On Sun, Apr 9, 2017 at 12:01 PM Brennan Vincent via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How difficult would it be to add a warning to Clang when the programmer<br class="gmail_msg">
performs a cast that provably has no effect?<br class="gmail_msg">
<br class="gmail_msg">
A particular case I have in mind is someone getting confused and calling<br class="gmail_msg">
std::move on an argument to a copy-constructor for a class that doesn't<br class="gmail_msg">
implement move semantics.<br class="gmail_msg">
<br class="gmail_msg">
I would be grateful if someone either (1) told me why this is<br class="gmail_msg">
difficult/impossible, or (2) gave me some pointers to where I could<br class="gmail_msg">
start trying to implement it...<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
LLVM Developers mailing list<br class="gmail_msg">
<a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="gmail_msg">
</blockquote></div></div>