================ @@ -9392,6 +9392,57 @@ ExprResult InitializationSequence::Perform(Sema &S, // Wrap it in a construction of a std::initializer_list<T>. CurInit = new (S.Context) CXXStdInitializerListExpr(Step->Type, MTE); + if (!Step->Type->isDependentType()) { + assert(S.isCompleteType(CurInit.get()->getExprLoc(), Step->Type, + Sema::CompleteTypeKind::Normal) && + "std::initializer_list<E> incomplete when used during " + "initialization"); + QualType ElementType; + [[maybe_unused]] bool IsStdInitializerList = + S.isStdInitializerList(Step->Type, &ElementType); + assert(IsStdInitializerList && + "StdInitializerList step to non-std::initializer_list"); + RecordDecl *Record = Step->Type->castAs<RecordType>()->getDecl(); + + auto InvalidType = [&] { + S.Diag(Record->getLocation(), + diag::err_std_initializer_list_malformed) + << Step->Type.getUnqualifiedType(); + return ExprError(); + }; + + // FIXME: What if the initializer_list type has base classes, etc? ---------------- Sirraide wrote:
We should check for that here. I don’t think there is a point in allowing `std::initializer_list` have bases or be polymorphic. https://github.com/llvm/llvm-project/pull/95580 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits