It is illegal to derefrercne to an interface in
objc's non-fragile ABI.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index c01097e..7072443 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -5023,8 +5023,15 @@
if (const PointerType *PT = Ty->getAs<PointerType>())
return PT->getPointeeType();
- if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType())
- return OPT->getPointeeType();
+ if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType()) {
+ QualType PTy = OPT->getPointeeType();
+ if (LangOpts.ObjCNonFragileABI && PTy->isObjCInterfaceType()) {
+ Diag(OpLoc, diag::err_indirection_requires_nonfragile_object)
+ << Ty << Op->getSourceRange();
+ return QualType();
+ }
+ return PTy;
+ }
Diag(OpLoc, diag::err_typecheck_indirection_requires_pointer)
<< Ty << Op->getSourceRange();