aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-01-29 01:15:48 +0000
committerAnders Carlsson <andersca@mac.com>2008-01-29 01:15:48 +0000
commitf6884ac7cfc4c5562c0678ad65b3460a38f56e23 (patch)
tree6bf6cb0df06894c5a37b8c41027105fecddc0b64 /CodeGen/CGExprScalar.cpp
parentff6e3c596e38328447461894cb8fd3ae22f499c4 (diff)
Correctly handle scalars in braces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46480 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CGExprScalar.cpp')
-rw-r--r--CodeGen/CGExprScalar.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp
index 8ec1a83318..652729ac27 100644
--- a/CodeGen/CGExprScalar.cpp
+++ b/CodeGen/CGExprScalar.cpp
@@ -130,7 +130,11 @@ public:
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();