[PATCH] D24905: Fix unreachable code false positive, vardecl in switch

Daniel Marjamäki via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 02:55:00 PDT 2016


danielmarjamaki added a comment.

In https://reviews.llvm.org/D24905#557573, @dcoughlin wrote:

> Sorry, missed this patch.
>
> I think it would good to add a test to make sure we do warn when the var decl has an initializer, since that will not be executed.
>
>   void varDecl(int X) {
>     switch (X) {
>       int A = 12; // We do want a warning here, since the variable will be uninitialized in C (This is not allowed in C++).
>     case 1:
>       ...
>       break;
>     }
>   }
>


I added such test case with 283096.


Repository:
  rL LLVM

https://reviews.llvm.org/D24905





More information about the cfe-commits mailing list