[cfe-commits] [PATCH] PR11778 Switch promotions working properly
David Blaikie
dblaikie at gmail.com
Tue Aug 28 13:18:52 PDT 2012
Could you include the test cases in your patch?
On Tue, Aug 28, 2012 at 1:11 PM, Ahmed Charles <acharles at outlook.com> wrote:
> 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.
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list