[cfe-dev] Taking the address of an Objective-C @selector expression
Tom Honermann
thonermann at coverity.com
Thu Apr 30 11:06:33 PDT 2015
On 04/30/2015 01:07 PM, Jonathan Roelofs wrote:
>> $ cat t.m
>> void f() {
>> @selector(AMethod) = @selector(AMethod);
>> &@selector(AMethod) = @selector(AMethod);
>> }
>>
>> $ clang -c t.m
>> t.m:2:24: error: expression is not assignable
>> @selector(AMethod) = @selector(AMethod);
>> ~~~~~~~~~~~~~~~~~~ ^
>> t.m:3:25: error: expression is not assignable
>> &@selector(AMethod) = @selector(AMethod);
>> ~~~~~~~~~~~~~~~~~~~ ^
>
> I can't think of any place where it makes sense to assign to the address
> of something (aside from operator&() in c++).
>
> Note that my first example had a '*' deref in it, whereas t.m does not.
Ugh, of course; carelessness on my part. I confirmed that the
assignment is not rejected in your case.
Tom.
More information about the cfe-dev
mailing list