[cfe-commits] [PATCH] PR11778 Switch promotions working properly

Ahmed Charles acharles at outlook.com
Tue Aug 28 15:37:26 PDT 2012


New patch, with test cases.

> Date: Tue, 28 Aug 2012 13:18:52 -0700
> Subject: Re: [cfe-commits] [PATCH] PR11778 Switch promotions working properly
> From: dblaikie at gmail.com
> To: acharles at outlook.com
> CC: cfe-commits at cs.uiuc.edu
> 
> 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
> >
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120828/e697416b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: switch-promotions.patch
Type: application/octet-stream
Size: 9284 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120828/e697416b/attachment.obj>


More information about the cfe-commits mailing list