Fix bug in vector initializer when initializing a vector with another vector.
Add test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129617 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 0ec122d..14a1222 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -841,6 +841,12 @@
// becomes every element of the vector, not just the first.
// This is the behavior described in the IBM AltiVec documentation.
if (NumInits == 1) {
+
+ // Handle the case where the vector is initialized by a another
+ // vector (OpenCL 6.1.6).
+ if (E->getInit(0)->getType()->isVectorType())
+ return this->Visit(const_cast<Expr*>(E->getInit(0)));
+
APValue InitValue;
if (EltTy->isIntegerType()) {
llvm::APSInt sInt(32);