Bad cast...need to use dyn_cast_or_null. Also changed Sema::InitBuiltinVaListType (which had the same bug).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43023 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 29a3b66..8ee0913 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -1896,9 +1896,9 @@
IdentifierInfo *NSIdent = &Context.Idents.get("NSConstantString");
ScopedDecl *IFace = LookupScopedDecl(NSIdent, Decl::IDNS_Ordinary,
SourceLocation(), TUScope);
- ObjcInterfaceDecl *stringInterface = cast<ObjcInterfaceDecl>(IFace);
- assert(stringInterface && "missing '@interface NSConstantString'");
- Context.setObjcConstantStringInterface(stringInterface);
+ ObjcInterfaceDecl *strIFace = dyn_cast_or_null<ObjcInterfaceDecl>(IFace);
+ assert(strIFace && "missing '@interface NSConstantString'");
+ Context.setObjcConstantStringInterface(strIFace);
}
QualType t = Context.getObjcConstantStringInterface();
t = Context.getPointerType(t);