Don't ICE (issue diagnostics) when receiver is a non-objc

type.

llvm-svn: 62355
This commit is contained in:
Fariborz Jahanian 2009-01-16 20:35:09 +00:00
parent 6bfc77d8fe
commit 10401ce2e0
2 changed files with 12 additions and 2 deletions

View File

@ -239,8 +239,9 @@ Sema::ExprResult Sema::ActOnClassMessage(
if (TypedefDecl *OCTD = dyn_cast_or_null<TypedefDecl>(IDecl)) {
const ObjCInterfaceType *OCIT;
OCIT = OCTD->getUnderlyingType()->getAsObjCInterfaceType();
if (OCIT)
ClassDecl = OCIT->getDecl();
if (!OCIT)
return Diag(receiverLoc, diag::err_invalid_receiver_to_message);
ClassDecl = OCIT->getDecl();
}
}
assert(ClassDecl && "missing interface declaration");

View File

@ -0,0 +1,9 @@
// RUN: clang -fsyntax-only -verify %s
typedef struct NotAClass {
int a, b;
} NotAClass;
void foo() {
[NotAClass nonexistent_method]; // expected-error {{invalid receiver to message expression}}
}