1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 @protocol MyProtocol @end
6 @interface NSObject @end
8 @interface NSInterm : NSObject <MyProtocol>
11 @interface NSArray : NSInterm
14 @interface NSSet : NSObject <MyProtocol>
18 @interface N1 : NSObject
21 @interface N1() <MyProtocol>
24 NSObject* test (int argc) {
25 NSArray *array = ((void*)0);
26 NSSet *set = ((void*)0);
27 return (argc) ? set : array ;
31 NSObject* test1 (int argc) {
32 NSArray *array = ((void*)0);
33 NSSet *set = ((void*)0);
34 id <MyProtocol> instance = (argc) ? array : set;
35 id <MyProtocol> instance1 = (argc) ? set : array;
38 id <MyProtocol> instance2 = (argc) ? set : n1;
39 id <MyProtocol> instance3 = (argc) ? n1 : array;
41 NSArray<MyProtocol> *qual_array = ((void*)0);
42 id <MyProtocol> instance4 = (argc) ? array : qual_array;
43 id <MyProtocol> instance5 = (argc) ? qual_array : array;
44 NSSet<MyProtocol> *qual_set = ((void*)0);
45 id <MyProtocol> instance6 = (argc) ? qual_set : qual_array;
46 id <MyProtocol> instance7 = (argc) ? qual_set : array;
47 id <MyProtocol> instance8 = (argc) ? qual_array : set;
48 id <MyProtocol> instance9 = (argc) ? qual_array : qual_set;
51 return (argc) ? array : set;