From 0d349f9b8a633b47b9fb26da5c41a791876fb34b Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 1 Feb 2011 00:52:10 +0000 Subject: 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 --- clang/lib/Sema/SemaInit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaInit.cpp') 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; -- cgit v1.2.3