https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113853
Bug ID: 113853 Summary: implicit move in throw in trailing return type Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- Found while working on bug 98388. This should compile fine in all dialects: ``` // { dg-do compile { target c++11 } } struct moveonly { moveonly() = default; moveonly(moveonly&&) = default; }; template<class T> constexpr auto is_throwable(T t) -> decltype(throw t, true) { return true; } template<class T> constexpr bool is_throwable(...) { return false; } constexpr bool b = is_throwable<moveonly>(moveonly{}); #if __cplusplus >= 202002L static_assert (b, "move from the function parameter"); #else static_assert (!b, "no move from the function parameter"); #endif ``` but it doesn't; see <https://gcc.gnu.org/pipermail/gcc-patches/2024-February/645275.html>.