type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62355
91177308-0d34-0410-b5e6-
96231b3b80d8
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");
--- /dev/null
+// 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}}
+}