ASTContext::mergeTypes(): Loosen up the type checking for 'Class' (treating it like 'id').
This fixes <rdar://problem/6782722> XCDataTipsManager.m registers, observes notifications in class methods.
The radar above is the result of clang typing 'self' in a class method as 'Class', which results in some spurious warnings (GCC types 'self' in a class method as 'id').
I considered changing the type of 'self' to 'id' (to conform to GCC), however this resulted in *many* test cases breaking. In addition, I really prefer a more strongly typed 'self'.
All in all, this is the least obtrusive fix I could find for removing the spurious warnings (though we do loose some valid warnings).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69041 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/class-method-self.m b/test/SemaObjC/class-method-self.m
new file mode 100644
index 0000000..d36bc8c
--- /dev/null
+++ b/test/SemaObjC/class-method-self.m
@@ -0,0 +1,26 @@
+// RUN: clang-cc -verify %s
+
+typedef struct objc_class *Class;
+@interface XX
+
+- (void)addObserver:(XX*)o;
+
+@end
+
+@interface YY
+
++ (void)classMethod;
+
+@end
+
+@implementation YY
+
+static XX *obj;
+
++ (void)classMethod {
+ [obj addObserver:self];
+ Class whatever;
+ [obj addObserver:whatever]; // GCC warns about this.
+}
+@end
+