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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 24 07:17:16 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.
----------------
AaronBallman wrote:

A compound literal expression is an ICE in C though?

> An integer constant expression116) shall have integer type and shall only have operands that are
integer constants, named and compound literal constants of integer type, character constants,
sizeof expressions whose results are integer constants, alignof expressions, and floating, named,
or compound literal constants of arithmetic type that are the immediate operands of casts. Cast
operators in an integer constant expression shall only convert arithmetic types to integer types,
except as part of an operand to the typeof operators, sizeof operator, or alignof operator.

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


More information about the cfe-commits mailing list