Hans Dembinski wrote:
On 9. Jan 2023, at 19:15, Peter Dimov via Boost
wrote: It will be better if you show how the existing code (before the delayed_forward transformation) looks like.
I added FooOld, which corresponds to the unsafe design I want to replace. https://godbolt.org/z/15q9EqnfP
Thanks. I note that as written, FooOld actually has the same problem even if the argument is not taken by value. template <class T> struct FooOld2 { FooOld2(bool b, T const& targ) : t_(targ) { if (b) throw 1; } FooOld2(bool b, T&& targ = {}) : t_(std::move(targ)) { if (b) throw 1; } private: T t_; }; There might be a difference between passing by value or not, but for that, the exception would have to be thrown from a base or previous member initialization, and not the constructor body.