aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjC
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-10-30 01:13:23 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-10-30 01:13:23 +0000
commite23fa2d0e84d1b878e012442a726c664216a9adf (patch)
tree5f6b6a88b772c9ceaa9c9ae570da59fdb0492ae9 /test/SemaObjC
parent1a31a18db9d657751f38c724adc0d62e86852bd7 (diff)
This patch computes composite type of two objective-c expressions
used in a conditional expression by finding the most-derived common super class of the two and qualifies the resulting type by the intersection of the protocl qualifier list of the two objective-c pointer types. ( this is continuation of radar 7334235). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85554 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjC')
-rw-r--r--test/SemaObjC/conditional-expr-6.m29
1 files changed, 27 insertions, 2 deletions
diff --git a/test/SemaObjC/conditional-expr-6.m b/test/SemaObjC/conditional-expr-6.m
index 88e943f3c6..bba51bb817 100644
--- a/test/SemaObjC/conditional-expr-6.m
+++ b/test/SemaObjC/conditional-expr-6.m
@@ -1,17 +1,25 @@
// RUN: clang-cc -fsyntax-only -verify %s
+@protocol MyProtocol @end
+
@interface NSObject @end
-@interface NSInterm : NSObject
+@interface NSInterm : NSObject <MyProtocol>
@end
@interface NSArray : NSInterm
@end
-@interface NSSet : NSObject
+@interface NSSet : NSObject <MyProtocol>
@end
+@interface N1 : NSObject
+@end
+
+@interface N1() <MyProtocol>
+@end
+
NSObject* test (int argc) {
NSArray *array = ((void*)0);
NSSet *set = ((void*)0);
@@ -22,5 +30,22 @@ NSObject* test (int argc) {
NSObject* test1 (int argc) {
NSArray *array = ((void*)0);
NSSet *set = ((void*)0);
+ id <MyProtocol> instance = (argc) ? array : set;
+ id <MyProtocol> instance1 = (argc) ? set : array;
+
+ N1 *n1 = ((void*)0);
+ id <MyProtocol> instance2 = (argc) ? set : n1;
+ id <MyProtocol> instance3 = (argc) ? n1 : array;
+
+ NSArray<MyProtocol> *qual_array = ((void*)0);
+ id <MyProtocol> instance4 = (argc) ? array : qual_array;
+ id <MyProtocol> instance5 = (argc) ? qual_array : array;
+ NSSet<MyProtocol> *qual_set = ((void*)0);
+ id <MyProtocol> instance6 = (argc) ? qual_set : qual_array;
+ id <MyProtocol> instance7 = (argc) ? qual_set : array;
+ id <MyProtocol> instance8 = (argc) ? qual_array : set;
+ id <MyProtocol> instance9 = (argc) ? qual_array : qual_set;
+
+
return (argc) ? array : set;
}