Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -525,16 +525,27 @@ template bool ByteCodeExprGen::VisitInitListExpr(const InitListExpr *E) { - for (const Expr *Init : E->inits()) { - if (DiscardResult) { - if (!this->discard(Init)) - return false; - } else { - if (!this->visit(Init)) - return false; - } + if (std::optional T = classify(E->getType())) { + assert(E->getNumInits() == 1); + return DiscardResult ? this->discard(E->inits()[0]) + : this->visit(E->inits()[0]); } - return true; + + if (std::optional LocalIndex = allocateLocal(E, false)) { + if (!this->emitGetPtrLocal(*LocalIndex, E)) + return false; + + if (!this->visitInitializer(E)) + return false; + + if (DiscardResult) + return this->emitPopPtr(E); + return true; + } + + // TODO: Array, complex, etc. types might appear here as well. + + return false; } template Index: clang/test/AST/Interp/records.cpp =================================================================== --- clang/test/AST/Interp/records.cpp +++ clang/test/AST/Interp/records.cpp @@ -895,3 +895,10 @@ #endif } + +#if 0 +constexpr bool BPand(BoolPair bp) { + return bp.first && bp.second; +} +static_assert(BPand(BoolPair{true, false}) == false, ""); +#endif