Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 // expected-no-diagnostics
      3 
      4 @protocol MyProtocol @end
      5 
      6 @interface NSObject @end
      7 
      8 @interface NSInterm : NSObject <MyProtocol>
      9 @end
     10 
     11 @interface NSArray : NSInterm 
     12 @end
     13 
     14 @interface NSSet : NSObject <MyProtocol>
     15 @end
     16 
     17 
     18 @interface N1 : NSObject
     19 @end
     20 
     21 @interface N1() <MyProtocol>
     22 @end
     23 
     24 NSObject* test (int argc) {
     25     NSArray *array = ((void*)0);
     26     NSSet *set = ((void*)0);
     27     return (argc) ? set : array ;
     28 }
     29 
     30 
     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;
     36 
     37     N1 *n1 = ((void*)0);
     38     id <MyProtocol> instance2 = (argc) ? set : n1;
     39     id <MyProtocol> instance3 = (argc) ? n1 : array;
     40 
     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;
     49 
     50 
     51     return (argc) ? array : set;
     52 }
     53