Correctly handle scalars in braces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46480 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp
index 8ec1a83..652729a 100644
--- a/CodeGen/CGExprScalar.cpp
+++ b/CodeGen/CGExprScalar.cpp
@@ -130,7 +130,11 @@
unsigned NumInitElements = E->getNumInits();
const llvm::VectorType *VType =
- cast<llvm::VectorType>(ConvertType(E->getType()));
+ dyn_cast<llvm::VectorType>(ConvertType(E->getType()));
+
+ // We have a scalar in braces. Just use the first element.
+ if (!VType)
+ return Visit(E->getInit(0));
unsigned NumVectorElements = VType->getNumElements();
const llvm::Type *ElementType = VType->getElementType();