================ @@ -15754,10 +15754,18 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx, LValue LVal; LVal.set(VD); - if (!EvaluateInPlace(Value, Info, LVal, this, - /*AllowNonLiteralTypes=*/true) || - EStatus.HasSideEffects) - return false; + { + // C++23 [intro.execution]/p5 + // A full-expression is ... an init-declarator ([dcl.decl]) or a + // mem-initializer. + // So we need to make sure temporary objects are destroyed after having + // evaluated the expression (per C++23 [class.temporary]/p4). ---------------- ChuanqiXu9 wrote:
```suggestion // evaluated the expression (per C++23 [class.temporary]/p4). // // FIXME: Otherwise this may break test/Modules/pr68702.cpp. because the serialization code // calls ParmVarDecl::getDefaultArg() which strips the outermost FullExpr, such as ExprWithCleanups. ``` I mean the reason why this is related to modules. I feel the analysis is valuable. https://github.com/llvm/llvm-project/pull/69076 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits