[clang] [clang][CodeGen] Emit file-scope compound literals in a constant context (PR #221390)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 16:50:11 PDT 2026
================
@@ -7449,6 +7449,31 @@ Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
return BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc, InitExpr);
}
+/// Whether the \p Index-th element of the semantic form of \p ILE initializes
+/// a reference member, so that its initializer is a glvalue that binds.
+static bool initializesReferenceMember(const InitListExpr *ILE,
----------------
efriedma-quic wrote:
Doing it this way is O(N^2) in the number of fields.
Can we just check if the initializer is an lvalue? It shouldn't be possible to have an lvalue as an operand to a compound literal unless it's binding to a reference.
https://github.com/llvm/llvm-project/pull/221390
More information about the cfe-commits
mailing list