[cfe-commits] r45489 - in /cfe/trunk: Parse/ParseObjc.cpp test/Parser/objc-messaging-neg-1.m
Fariborz Jahanian
fjahanian at apple.com
Thu Jan 3 09:32:07 PST 2008
On Jan 3, 2008, at 4:40 AM, Nico Weber wrote:
>> Prevent crash on incorrect objc messaging expression.
>>
>> +// RUN: clang -fsyntax-only -verify %s
>> +
>> +int main()
>> + {
>> + id a;
>> + [a bla:0 6:7]; // expected-error {{expected ']'}}
>> + }
>
> Better. But still a bit strange. Consider this test case:
>
> @interface Bla
> {
> }
>
> - (id):(int)i with:(NSString *)s : (int)j;
>
> @end
>
> int main()
> {
> Bla* bla;
> [bla:4 with: @"bla" 0:0];
> }
>
> This gives the expected error from above. However,
>
> @interface Bla
> {
> }
>
> - (id):(int)i with:(NSString *)s : (int)j;
>
> @end
>
> int main()
> {
> Bla* bla;
> [bla:4 with: @"bla" @"bla":0];
> }
>
This is OK. You are concatenating cf strings. Effectively messaging as:
[bla:4 with: @"blabla" :0];
- Fariborz
> does not give any error or warning (the only difference is that I
> replaced `0:0` with `@"bla":0`). I guess it should produce the same
> error as the first program.
>
> Nico
More information about the cfe-commits
mailing list