[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

Malcolm Parsons via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 09:34:50 PDT 2016


malcolm.parsons marked 15 inline comments as done.
malcolm.parsons added inline comments.


================
Comment at: test/clang-tidy/modernize-use-auto-cast.cpp:14
+  long l = 1;
+  int i1 = static_cast<int>(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
----------------
Prazek wrote:
> How do you handle cases like
> 
>   long l = static_cast<int>(i1);
> 
> I would expect it to produce warning, but not produce fixit (because it might change the behavior of program), but I still would like to get information about it because it seems like a bug.
The check requires the VarDecl and Initializer to have the same type, so there is no warning.
I don't think this check should warn about it.


https://reviews.llvm.org/D25316





More information about the cfe-commits mailing list