brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · ed941db Raw
51 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2// pr84533 4@protocol NSCopying @end5@protocol NSPROTO @end6@protocol NSPROTO1 @end7@protocol NSPROTO2 @end8 9@interface NSObject <NSCopying, NSPROTO, NSPROTO1> {10    Class isa;11}12@end13 14void gorf(NSObject <NSCopying> *); // expected-note {{passing argument to parameter here}}15 16NSObject <NSCopying> *foo(id <NSCopying> bar, id id_obj)17{18 	NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying>'}}19        NSObject *Init1 = bar; // expected-warning {{initializing 'NSObject *' with an expression of incompatible type 'id<NSCopying>'}}20 21 	NSObject <NSCopying> *I = id_obj; 22        NSObject *I1 = id_obj; 23        gorf(bar);	// expected-warning {{passing 'id<NSCopying>' to parameter of incompatible type 'NSObject<NSCopying> *'}}24 25        gorf(id_obj);	26 27	return bar; 	// expected-warning {{returning 'id<NSCopying>' from a function with incompatible result type 'NSObject<NSCopying> *'}} 28}29 30void test(id <NSCopying, NSPROTO, NSPROTO2> bar)31{32  NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying,NSPROTO,NSPROTO2>'}}33}34 35@interface NSObject (CAT)36+ (struct S*)Meth : (struct S*)arg;37@end38 39struct S {40 char *types;41};42 43@interface I44@end45 46@implementation I47- (struct S *)Meth : (struct S*)a {48  return [NSObject Meth : a];49}50@end51