<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Apr 9, 2017 at 12:35 PM, Craig Topper 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>This is question is probably better on the clang cfe-dev list. </div><div><br><div class="gmail_quote"><div>On Sun, Apr 9, 2017 at 12:01 PM Brennan Vincent via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-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">How difficult would it be to add a warning to Clang when the programmer<br class="gmail-m_7839937564111292971gmail_msg">
performs a cast that provably has no effect?<br class="gmail-m_7839937564111292971gmail_msg">
<br class="gmail-m_7839937564111292971gmail_msg">
A particular case I have in mind is someone getting confused and calling<br class="gmail-m_7839937564111292971gmail_msg">
std::move on an argument to a copy-constructor for a class that doesn't<br class="gmail-m_7839937564111292971gmail_msg">
implement move semantics.<br class="gmail-m_7839937564111292971gmail_msg">
<br class="gmail-m_7839937564111292971gmail_msg">
I would be grateful if someone either (1) told me why this is<br class="gmail-m_7839937564111292971gmail_msg">
difficult/impossible, or (2) gave me some pointers to where I could<br class="gmail-m_7839937564111292971gmail_msg">
start trying to implement it...<br class="gmail-m_7839937564111292971gmail_msg"></blockquote></div></div></blockquote><div><br></div><div>clang-tidy has related diagnostics, such as those listed at <a href="https://clang.llvm.org/extra/clang-tidy/checks/misc-move-const-arg.html">https://clang.llvm.org/extra/clang-tidy/checks/misc-move-const-arg.html</a></div><div><br></div><div>Not all of them are desirable, IMO, but clang-tidy (rather than clang-the-compiler) is the right place for them.</div><div><br></div><div>-- James </div></div></div></div>