summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-01 00:52:10 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-01 00:52:10 +0000
commit0d349f9b8a633b47b9fb26da5c41a791876fb34b (patch)
tree72f0e4f9d04c3c6306ba726fd94d662d23eacf65 /clang/lib/Sema/SemaInit.cpp
parentc46f94d4902288823c9b77aa7d21e7cf6b5b4c13 (diff)
downloadbcm5719-llvm-0d349f9b8a633b47b9fb26da5c41a791876fb34b.tar.gz
bcm5719-llvm-0d349f9b8a633b47b9fb26da5c41a791876fb34b.zip
When initializing struct members, the important thing is that the "initializing" expression is
compatible, not having the same type. Fix rdar://8183908 in which compatible vector types weren't initialized properly leading to a crash. llvm-svn: 124637
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 589e971ccb8..3aeb5188270 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -697,7 +697,8 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
// initial value of the object, including unnamed members, is
// that of the expression.
if ((ElemType->isRecordType() || ElemType->isVectorType()) &&
- SemaRef.Context.hasSameUnqualifiedType(expr->getType(), ElemType)) {
+ SemaRef.CheckSingleAssignmentConstraints(ElemType, expr)
+ == Sema::Compatible) {
SemaRef.DefaultFunctionArrayLvalueConversion(expr);
UpdateStructuredListElement(StructuredList, StructuredIndex, expr);
++Index;
OpenPOWER on IntegriCloud