summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/ASTContext.cpp2
-rw-r--r--clang/test/SemaObjC/block-type-safety.m17
-rw-r--r--clang/test/SemaObjC/comptypes-5.m4
3 files changed, 20 insertions, 3 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 8051dca5a6a..988bedb1c03 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -4336,7 +4336,7 @@ bool ASTContext::ObjCQualifiedIdTypesAreCompatible(QualType lhs, QualType rhs,
// when comparing an id<P> on rhs with a static type on lhs,
// static class must implement all of id's protocols directly or
// indirectly through its super class.
- if (lhsID->ClassImplementsProtocol(*I, false)) {
+ if (lhsID->ClassImplementsProtocol(*I, true)) {
match = true;
break;
}
diff --git a/clang/test/SemaObjC/block-type-safety.m b/clang/test/SemaObjC/block-type-safety.m
index 402a658f3e3..c13e80618d5 100644
--- a/clang/test/SemaObjC/block-type-safety.m
+++ b/clang/test/SemaObjC/block-type-safety.m
@@ -104,3 +104,20 @@ void test3() {
f4(^(NSArray<P2>* a) { }); // expected-error {{incompatible block pointer types passing 'void (^)(NSArray<P2> *)' to parameter of type 'void (^)(id<P>)'}}
}
+// rdar : //8302845
+@protocol Foo @end
+
+@interface Baz @end
+
+@interface Baz(FooConformance) <Foo>
+@end
+
+@implementation Baz @end
+
+int test4 () {
+ id <Foo> (^b)() = ^{ // Doesn't work
+ return (Baz *)0;
+ };
+ return 0;
+}
+
diff --git a/clang/test/SemaObjC/comptypes-5.m b/clang/test/SemaObjC/comptypes-5.m
index f652f0e1a1f..46300e3a530 100644
--- a/clang/test/SemaObjC/comptypes-5.m
+++ b/clang/test/SemaObjC/comptypes-5.m
@@ -26,8 +26,8 @@ int main()
MyOtherClass<MyProtocol> *obj_c_super_p_q = nil;
MyClass<MyProtocol> *obj_c_cat_p_q = nil;
- obj_c_cat_p = obj_id_p; // expected-warning {{assigning to 'MyClass *' from incompatible type 'id<MyProtocol>'}}
- obj_c_super_p = obj_id_p; // expected-warning {{assigning to 'MyOtherClass *' from incompatible type 'id<MyProtocol>'}}
+ obj_c_cat_p = obj_id_p;
+ obj_c_super_p = obj_id_p;
obj_id_p = obj_c_cat_p; /* Ok */
obj_id_p = obj_c_super_p; /* Ok */
OpenPOWER on IntegriCloud