[cfe-commits] [PATCH] PR11778 Switch promotions working properly
Ahmed Charles
acharles at outlook.com
Tue Aug 28 13:11:08 PDT 2012
This makes switch statements like the following compile:
int f1(char c) { switch(c) { case 256: case 0: return 1; } return 0; }
int f2(unsigned char c) { switch(c) { case 256: case 0: return 1; } return 0; }
int f3(char c) { switch(c) { case 255 ... 256: case 0: return 1; } return 0; }
int f3(unsigned char c) { switch(c) { case 255 ... 256: case 0: return 1; } return 0; }
The condition in the switch statement undergoes integer promotions, therefore the above should compile, but doesn't. This also adds a warning which tells the user when a case can't be reached.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120828/cd84efcf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: switch-promotions.patch
Type: application/octet-stream
Size: 9078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120828/cd84efcf/attachment.obj>
More information about the cfe-commits
mailing list