Initialize the Init variable to something reasonable when we emit an
error, so we don't crash.
llvm-svn: 65099
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 3d01770..7432b01 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -626,8 +626,11 @@
Init = llvm::Constant::getNullValue(InitTy);
} else {
Init = EmitConstantExpr(D->getInit());
- if (!Init)
+ if (!Init) {
ErrorUnsupported(D, "static initializer");
+ QualType T = D->getInit()->getType();
+ Init = llvm::UndefValue::get(getTypes().ConvertType(T));
+ }
}
const llvm::Type* InitType = Init->getType();