[cfe-commits] r106242 - in /cfe/trunk: lib/AST/Expr.cpp lib/Sema/SemaExpr.cpp test/CodeGenCXX/sel-address.mm test/CodeGenObjCXX/selactor-expr-lvalue.mm

Nico Weber thakis at chromium.org
Thu Jun 17 15:17:23 PDT 2010


On Thu, Jun 17, 2010 at 3:13 PM, Fariborz Jahanian <fjahanian at apple.com>wrote:

>
> On Jun 17, 2010, at 2:56 PM, Nico Weber wrote:
>
>
>>
>>  @interface NSObject {}
>> -- (void)respondsToSelector:(SEL&)s : (SEL*)s1;
>> +- (void)respondsToSelector:(const SEL&)s : (SEL*)s1;
>>
>
> Shouldn't non-const SEL references still work?
>
> Message would be:
> t.mm:11:30: error: non-const lvalue reference to type 'SEL' cannot bind to
> a temporary of type 'SEL'
>     [self respondsToSelector:@selector(setPriority:)];
>                              ^~~~~~~~~~~~~~~~~~~~~~~
>

Oh, sorry, didn't look at the calling site.

  SEL a;
  [self respondsToSelector:a];

should still work though :-)


> It is not an lvalue, it cannot be passed by reference.
> Message is coming out of c++ side. Presumably no different that:
> void foo(int&);
> int main()
> {
>     foo(10);
> }
>
>
> - Fariborz
>
>
>
>
>>  - (void) setPriority:(int)p;
>>  - (void)Meth;
>>  @end
>> @@ -12,5 +12,5 @@
>>     [self respondsToSelector:@selector(setPriority:) :
>> &@selector(setPriority:)];
>>  }
>>  - (void) setPriority:(int)p{}
>> -- (void)respondsToSelector:(SEL&)s : (SEL*)s1 {}
>> +- (void)respondsToSelector:(const SEL&)s : (SEL*)s1 {}
>>  @end
>>
>>
>> _______________________________________________
>> 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/20100617/abfd148a/attachment.html>


More information about the cfe-commits mailing list