[cfe-commits] r158899 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/SemaObjC/blocks.m

Jordan Rose jordan_rose at apple.com
Fri Jun 29 15:45:49 PDT 2012


On Jun 29, 2012, at 11:22 , Douglas Gregor <dgregor at apple.com> wrote:

> 
> On Jun 20, 2012, at 10:54 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
>> Author: jrose
>> Date: Thu Jun 21 00:54:55 2012
>> New Revision: 158899
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=158899&view=rev
>> Log:
>> Pretend that enum constants have enum type when inferring a block return type.
>> 
>> In C, enum constants have the type of the enum's underlying integer type,
>> rather than the type of the enum. (This is not true in C++.) This leads to
>> odd warnings when returning enum constants directly in blocks with inferred
>> return types. The easiest way out of this is to pretend that, like C++, enum
>> constants have enum type when being returned from a block.
>> 
>> <rdar://problem/11662489>
> 
> While possibly convenient, this is a source-compatibility-breaking change to something that has been stable for *years*. I'd support doing this for enumerators of enumerations with a fixed underlying type, because that's a new extension in Objective-C.
> 
> 	- Doug

Internal discussion has resulted in deciding to just do the right thing and look at all the return statements when we reach the end of the block/lambda. I'll get this working soon.

Jordan



More information about the cfe-commits mailing list