[clang] [clang][Sema] Expand `#embed` in braced lists that initialize non-aggregates (PR #231938)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 18 19:46:02 PDT 2026


================
@@ -1718,7 +1718,7 @@ void InitListChecker::CheckComplexType(const InitializedEntity &Entity,
   // the element type of the complex type. The first element initializes
   // the real part, and the second element intitializes the imaginary part.
 
-  if (IList->getNumInits() < 2)
+  if (IList->getNumInitsWithEmbedExpanded() < 2)
----------------
efriedma-quic wrote:

We could have "hasZeroInits()" and "hasOneInit()" methods, which wouldn't require iterating over the whole init list.  (An initializer has zero inits if it has zero subexpressions.  An initializer has one init if it has one sub-expression, and that subexpression isn't an EmbedExpr with more than one element.)

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


More information about the cfe-commits mailing list