-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing warnings on switch(boolean_expr) #5562
Comments
This was forked from #4779 filed by nlewycky@google.com. |
This bug depends on llvm/llvm-bugzilla-archive#5206 . |
A patch was sent to cfe-commits for review. |
according to Edward, the patch didn't apply cleanly to mainline, please update and resend when you get a chance, thanks! |
I did an 'svn up' and didn't see any conflict, so I'm not where why the patch wouldn't work for the trunk. I just tried this in a clean svn checkout: patch -p 0 -i pr5190.patch and it worked fine. Could you try again? Thanks. BTW, this patch adds a new file test/SemaCXX/switch.cpp. Don't know if this has anything to do with what Edward saw. |
proposed fix |
No idea why it was not applying, so I did it by hand. Committed in revision 84346. Many thanks, |
mentioned in issue llvm/llvm-bugzilla-archive#5206 |
Cherry-pick many LLDB improvements
Extended Description
Clang should warn on switch(bool) since it's almost certainly wrong
(developers seem okay with using if-statements instead).
int test2(const char foo) {
int success = 0;
switch (foo && foo[0]) { / XXX */
case 0:
success = 1;
break;
case 1:
break;
}
return success;
}
The text was updated successfully, but these errors were encountered: