Debian Codegraph @

clang/test/SemaObjC/attr-objc-NSObject.m

raw
1 // RUN: %clang_cc1 -verify -Wno-objc-root-class -fsyntax-only %s
2
3 @interface NSArray<__covariant ObjectType>
4 - (void)containsObject:(ObjectType)anObject; // expected-note {{passing argument to parameter 'anObject' here}}
5 - (void)description;
6 @end
7
8 typedef __attribute__((NSObject)) struct Foo *FooRef;
9 typedef struct Bar *BarRef;
10
11 void good() {
12 FooRef object;
13 NSArray<FooRef> *array;
14 [array containsObject:object];
15 [object description];
16 }
17
18 void bad() {
19 BarRef object;
20 NSArray<BarRef> *array; // expected-error {{type argument 'BarRef' (aka 'struct Bar *') is neither an Objective-C object nor a block type}}
21 [array containsObject:object]; // expected-error {{incompatible pointer types sending 'BarRef' (aka 'struct Bar *') to parameter of type 'id'}}
22 [object description]; // expected-warning {{receiver type 'BarRef' (aka 'struct Bar *') is not 'id' or interface pointer, consider casting it to 'id'}}
23 }