[llvm-dev] [cfe-dev] Spurious cast warning for C++?

James Dennett via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 10 13:45:24 PDT 2017


On Sun, Apr 9, 2017 at 12:35 PM, Craig Topper via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> This is question is probably better on the clang  cfe-dev list.
>
> On Sun, Apr 9, 2017 at 12:01 PM Brennan Vincent via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> How difficult would it be to add a warning to Clang when the programmer
>> performs a cast that provably has no effect?
>>
>> A particular case I have in mind is someone getting confused and calling
>> std::move on an argument to a copy-constructor for a class that doesn't
>> implement move semantics.
>>
>> I would be grateful if someone either (1) told me why this is
>> difficult/impossible, or (2) gave me some pointers to where I could
>> start trying to implement it...
>>
>
clang-tidy has related diagnostics, such as those listed at
https://clang.llvm.org/extra/clang-tidy/checks/misc-move-const-arg.html

Not all of them are desirable, IMO, but clang-tidy (rather than
clang-the-compiler) is the right place for them.

-- James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170410/d3d8cbac/attachment.html>


More information about the llvm-dev mailing list