Teach Sema::ActOnCompoundLiteral about constraint C99 6.5.2.5p3.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45782 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 7d224c5..8974325 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -664,8 +664,9 @@
Expr *literalExpr = static_cast<Expr*>(InitExpr);
// FIXME: add more semantic analysis (C99 6.5.2.5).
- if (CheckInitializer(literalExpr, literalType, false))
- return 0;
+ bool requireConstantExprs = !CurFunctionDecl && !CurMethodDecl;
+ if (CheckInitializer(literalExpr, literalType, requireConstantExprs))
+ return true;
return new CompoundLiteralExpr(LParenLoc, literalType, literalExpr);
}