Improve diagnostic for illegal array initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46869 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 0077691..b81f3fe 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -659,6 +659,12 @@
// FIXME: Handle wide strings
if (StringLiteral *strLiteral = IsStringLiteralInit(Init, DeclType))
return CheckStringLiteralInit(strLiteral, DeclType);
+
+ if (DeclType->isArrayType())
+ return Diag(Init->getLocStart(),
+ diag::err_array_init_list_required,
+ Init->getSourceRange());
+
return CheckSingleInitializer(Init, DeclType);
}
unsigned newIndex = 0;