cor3ntin added a comment. In D139586#4000309 <https://reviews.llvm.org/D139586#4000309>, @hubert.reinterpretcast wrote:
> At least on the surface, it looks like there will be a lot of trouble to deal > with default arguments: > > struct A { A(); ~A(); int x[3]; }; > int (&f(const A & = A()))[3]; > void bar(int); > void foo() { > for (auto e : f()) { bar(e); } > } > > We get a `CXXDefaultArgExpr`, and the expression on the parameter declaration > is what has the `MaterializeTemporaryExpr`. It looks like we now have cases > where different call sites require different semantics (and perhaps different > diagnostics, somewhat like template instantiations). This PR https://reviews.llvm.org/D136554 adds some machinery to rewrite `CXXDefaultArgExpr` when they are used, so we could, if needed, reuse that machinery to inject `MaterializeTemporaryExpr` (as part of D136554 <https://reviews.llvm.org/D136554> the rewrite only happen in the presence of immediate function calls) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139586/new/ https://reviews.llvm.org/D139586 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits