For struct initialization, check compatibility with the unqualified
type; this isn't explicitly stated in the standard, but it doesn't
really make sense for them to have an effect here. Fixes the included
testcase, sent to me by Steve Naroff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52113 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 43adc2a..e2377e1 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -165,7 +165,9 @@
} else if (ElemType->isScalarType()) {
CheckScalarType(IList, ElemType, Index);
} else if (expr->getType()->getAsRecordType() &&
- SemaRef->Context.typesAreCompatible(expr->getType(), ElemType)) {
+ SemaRef->Context.typesAreCompatible(
+ expr->getType().getUnqualifiedType(),
+ ElemType.getUnqualifiedType())) {
Index++;
// FIXME: Add checking
} else {