ObjCProtocolDecl *PDecl = QIT->getProtocols(i);
if (PDecl && (Method = PDecl->lookupInstanceMethod(Sel)))
break;
+ // Since we aren't supporting "Class<foo>", look for a class method.
+ if (PDecl && (Method = PDecl->lookupClassMethod(Sel)))
+ break;
}
} else if (const ObjCInterfaceType *OCIType =
ReceiverCType->getAsPointerToObjCInterfaceType()) {
}
+ (int) class_func2
{
- int i = [(id <Func>)self class_func0]; // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}} // expected-warning {{incompatible pointer to integer conversion initializing 'id', expected 'int'}}
- i += [(id <Func>)super class_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}} // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}} // expected-warning {{incompatible pointer to integer conversion assigning 'id', expected 'int'}}
+ int i = [(id <Func>)self class_func0];
+ i += [(id <Func>)super class_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
i += [(Class <Func>)self class_func0]; // expected-error {{protocol qualified 'Class' is unsupported}}
return i + [(Class <Func>)super class_func0]; // expected-error {{protocol qualified 'Class' is unsupported}} // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
}
--- /dev/null
+// RUN: clang-cc -fsyntax-only -verify %s
+
+#include <stddef.h>
+
+typedef struct objc_class *Class;
+typedef struct objc_object {
+ Class isa;
+} *id;
+id objc_getClass(const char *s);
+
+@interface Object
++ self;
+@end
+
+@protocol Func
++ (void) class_func0;
+- (void) instance_func0;
+@end
+
+@interface Derived: Object <Func>
+@end
+
+@interface Derived2: Object <Func>
+@end
+
+static void doSomething(Class <Func> unsupportedObjectType) { // expected-error {{protocol qualified 'Class' is unsupported}}
+ [unsupportedObjectType class_func0];
+}
+
+static void doSomethingElse(id <Func> pleaseConvertToThisType) {
+ [pleaseConvertToThisType class_func0];
+}
+
+int main(int argv, char *argc[]) {
+ doSomething([Derived self]);
+ doSomething([Derived2 self]);
+ doSomethingElse([Derived self]);
+ doSomethingElse([Derived2 self]);
+}
+