SourceRange(lbrac, rbrac));
}
else {
- assert(ObjCInterfaceType::classof(receiverType.getTypePtr()) &&
- "bad receiver type");
+ if (!isa<ObjCInterfaceType>(receiverType.getTypePtr())) {
+ Diag(lbrac, diag::error_bad_receiver_type, receiverType.getAsString());
+ return true;
+ }
ClassDecl = static_cast<ObjCInterfaceType*>(
receiverType.getTypePtr())->getDecl();
// FIXME: consider using InstanceMethodPool, since it will be faster
"Only one element declaration is allowed")
DIAG(warn_expected_implementation, WARNING,
"@end must appear in an @implementation context")
+DIAG(error_bad_receiver_type, ERROR,
+ "bad receiver type (its type is '%0')")
//===----------------------------------------------------------------------===//
// Semantic Analysis
--- /dev/null
+// RUN: clang -fsyntax-only -verify %s
+
+@interface I
+- (id) retain;
+@end
+
+void __raiseExc1() {
+ [objc_lookUpClass("NSString") retain]; // expected-error {{ "bad receiver type (its type is 'int')" }}
+}