[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

Fariborz Jahanian fjahanian at apple.com
Thu Jun 17 15:13:46 PDT 2010


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:)];
                              ^~~~~~~~~~~~~~~~~~~~~~~

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/a8bed2f4/attachment.html>


More information about the cfe-commits mailing list