================
@@ -7241,10 +7241,21 @@ Sema::BuildCompoundLiteralExpr(SourceLocation
LParenLoc, TypeSourceInfo *TInfo,
? VK_PRValue
: VK_LValue;
+ // C99 6.5.2.5
+ // "If the compound literal occurs outside the body of a function, the
+ // initializer list shall consist of constant expressions."
if (IsFileScope)
if (auto ILE = dyn_cast<InitListExpr>(LiteralExpr))
for (unsigned i = 0, j = ILE->getNumInits(); i != j; i++) {
Expr *Init = ILE->getInit(i);
+ if (!Init->isTypeDependent() && !Init->isValueDependent() &&
+ !Init->getType()->isDependentType())
----------------
Mr-Anyone wrote:
> I don't think you need the check for `!Init->getType()->isDependentType()`
> because `computeDependence()` on the expression should already account for
> that, shouldn't it?
You're absolutely right—I just removed that check. Thanks!
https://github.com/llvm/llvm-project/pull/139479
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits