[cfe-commits] r141966 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Douglas Gregor dgregor at apple.com
Fri Oct 14 12:55:35 PDT 2011


On Oct 14, 2011, at 12:08 PM, jahanian wrote:

> 
> On Oct 14, 2011, at 11:40 AM, Douglas Gregor wrote:
> 
>> 
>> On Oct 14, 2011, at 11:31 AM, Fariborz Jahanian wrote:
>> 
>>> Author: fjahanian
>>> Date: Fri Oct 14 13:31:36 2011
>>> New Revision: 141966
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=141966&view=rev
>>> Log:
>>> Make value kind based on the return type of the getter, not
>>> property type, for when getter may be a reference type.
>>> // rdar://10188258 revised.
>> 
>> Dare I ask for a test case?
> 
> Interesting that you asked. Currently, we warn for the getter (but not on the setter!). Need to fix it before sending a test case.
> 
> struct Foo {int i;};
> 
> @interface ObjCTest  { }
> @property (nonatomic, readonly) Foo FooProperty;
> - (Foo &) FooProperty;
> - (void)  SetFooProperty : (Foo &) arg;
> @end
> 
> % clang -fsyntax-only ref-bug.mm 
> ref-bug.mm:4:37: warning: type of property 'FooProperty' does not match type of accessor 'FooProperty'
> @property (nonatomic, readonly) Foo FooProperty;
>                                     ^
> ref-bug.mm:5:1: note: declared here
> - (Foo &) FooProperty;
> ^
> 1 warning generated.

Ah, interesting. It seems like we should allow the getter/setter to return/take parameters by reference.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111014/b11119b6/attachment.html>


More information about the cfe-commits mailing list