1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
5 @interface NSObject <NSObject> {
8 @interface NSString : NSObject
10 void __setRetained(id *ivar, id value, NSObject **o) {
13 static NSString *_logProcessPrefix = 0;
15 __setRetained(&_logProcessPrefix, _logProcessPrefix, &_logProcessPrefix);
17 @implementation NSObject (ScopeAdditions)
18 + (void)setObjectLogProcessPrefix:(NSString *)processPrefix {
19 __setRetained(&_logProcessPrefix, processPrefix, &_logProcessPrefix);
25 NSObject *ExternFunc (NSObject *filePath, NSObject *key);
26 typedef id FuncSignature (NSObject *arg1, Derived *arg2);
28 @interface Derived: NSObject
29 + (void)registerFunc:(FuncSignature *)function; // expected-note{{passing argument to parameter 'function' here}}
34 // GCC currently allows this (it has some fairly new support for covariant return types and contravariant argument types).
35 // Since registerFunc: expects a Derived object as it's second argument, I don't know why this would be legal.
36 [Derived registerFunc: ExternFunc]; // expected-error{{incompatible function pointer types sending 'NSObject *(NSObject *, NSObject *)' to parameter of type 'FuncSignature *' (aka 'id (*)(NSObject *, Derived *)')}}
39 @protocol NSCopying @end
41 - (void) Meth : (id <NSCopying>)aKey; // expected-note {{passing argument to parameter 'aKey' here}}
44 @class ForwarClass; // expected-note 3 {{conformance of forward class 'ForwarClass' to protocol 'NSCopying' can not be confirmed}}
46 ForwarClass *Test10751015 (I* pi, ForwarClass *ns_forward) {
48 [pi Meth : ns_forward ]; // expected-warning {{sending 'ForwarClass *' to parameter of incompatible type 'id<NSCopying>'}}
50 id <NSCopying> id_ns = ns_forward; // expected-warning {{initializing 'id<NSCopying>' with an expression of incompatible type 'ForwarClass *'}}
52 return id_ns; // expected-warning {{returning 'id<NSCopying>' from a function with incompatible result type 'ForwarClass *'}}