[clang] [clang][CompundLiteralExpr] Don't defer evaluation for CLEs (PR #137163)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 25 03:40:06 PDT 2025


================
@@ -3489,6 +3489,11 @@ class CompoundLiteralExpr : public Expr {
   /// The int part of the pair stores whether this expr is file scope.
   llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
   Stmt *Init;
+
+  /// Value of constant literals with static storage duration. Used only for
+  /// constant folding as CompoundLiteralExpr is not an ICE.
----------------
kadircet wrote:

i am happy to drop that comment, but I was inclined to preserve it as well since I came across logic aligned with that in couple of other places too, e.g. https://github.com/llvm/llvm-project/blob/5bad5d84a15a4f36b8ed5b33dde924683bcc9ea1/clang/lib/AST/ExprConstant.cpp#L17278. There's likely more dragons lurking in here.

https://github.com/llvm/llvm-project/pull/137163


More information about the cfe-commits mailing list