Fixed implementation of C89 6.5.7 p3.
Warning should be emitted only for InitListExpr nodes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186859 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 840a735..8b7c472 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -7785,6 +7785,7 @@
// for an object that has aggregate or union type shall be
// constant expressions.
else if (!getLangOpts().C99 && VDecl->getType()->isAggregateType() &&
+ isa<InitListExpr>(Init) &&
!Init->isConstantInitializer(Context, false))
Diag(Init->getExprLoc(),
diag::ext_aggregate_init_not_constant)