Correctly propagating a `decltype(auto)` variable from a function
That’s the simplest and most clear way to write it: template <typename F> auto invoke_log_return(F&& f) { auto result = f(); std::printf(” …logging here… %s\n”, result.foo()); return result; } The GCC gets the right (no needless copies or moves) expected result: s() in main prvalue s() …logging here… Foo! lvalue s(const s&) …logging here… Foo! … Read more