On Fri, Jun 10, 2011 at 6:09 PM, Douglas Gregor <[email protected]> wrote: > Author: dgregor > Date: Fri Jun 10 20:09:30 2011 > New Revision: 132868 > > URL: http://llvm.org/viewvc/llvm-project?rev=132868&view=rev > Log: > Implement Objective-C Related Result Type semantics. > > Related result types apply Cocoa conventions to the type of message > sends and property accesses to Objective-C methods that are known to > always return objects whose type is the same as the type of the > receiving class (or a subclass thereof), such as +alloc and > -init. This tightens up static type safety for Objective-C, so that we > now diagnose mistakes like this: > > t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' > with an > expression of type 'NSArray *' [-Wincompatible-pointer-types] > NSSet *array = [[NSArray alloc] init]; > ^ ~~~~~~~~~~~~~~~~~~~~~~ > /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: > note: > instance method 'init' is assumed to return an instance of its > receiver > type ('NSArray *') > - (id)init; > ^ > > It also means that we get decent type inference when writing code in > Objective-C++0x: > > auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; > // ^ now infers NSMutableArray* rather than id
Would you mind taking a look at the failures on http://smooshlab.apple.com:8013/builders/gccTestSuite_clang-x86_64-darwin10-RA__obj-c and http://smooshlab.apple.com:8013/builders/gccTestSuite_clang-x86_64-darwin10-RA__obj-c++ ? I think this commit is the cause. -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
