1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 @protocol MyProtocol @end 4 5 @interface NSObject @end 6 7 @interface NSInterm : NSObject <MyProtocol> 8 @end 9 10 @interface NSArray : NSInterm 11 @end 12 13 @interface NSSet : NSObject <MyProtocol> 14 @end 15 16 17 @interface N1 : NSObject 18 @end 19 20 @interface N1() <MyProtocol> 21 @end 22 23 NSObject* test (int argc) { 24 NSArray *array = ((void*)0); 25 NSSet *set = ((void*)0); 26 return (argc) ? set : array ; 27 } 28 29 30 NSObject* test1 (int argc) { 31 NSArray *array = ((void*)0); 32 NSSet *set = ((void*)0); 33 id <MyProtocol> instance = (argc) ? array : set; 34 id <MyProtocol> instance1 = (argc) ? set : array; 35 36 N1 *n1 = ((void*)0); 37 id <MyProtocol> instance2 = (argc) ? set : n1; 38 id <MyProtocol> instance3 = (argc) ? n1 : array; 39 40 NSArray<MyProtocol> *qual_array = ((void*)0); 41 id <MyProtocol> instance4 = (argc) ? array : qual_array; 42 id <MyProtocol> instance5 = (argc) ? qual_array : array; 43 NSSet<MyProtocol> *qual_set = ((void*)0); 44 id <MyProtocol> instance6 = (argc) ? qual_set : qual_array; 45 id <MyProtocol> instance7 = (argc) ? qual_set : array; 46 id <MyProtocol> instance8 = (argc) ? qual_array : set; 47 id <MyProtocol> instance9 = (argc) ? qual_array : qual_set; 48 49 50 return (argc) ? array : set; 51 } 52