https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86943
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I'll just include the testcase for the testsuite from the above patch: // PR c++/86943 // { dg-do run { target c++14 } } int c[3]; struct S { S () : s (1234) { c[0]++; } S (const S &) { __builtin_abort (); } S (S &&x) noexcept { if (x.s != 1234) __builtin_abort (); s = 1234; x.s = 2345; c[1]++; } ~S () { if (s != 1234 && s != 2345) __builtin_abort (); c[2]++; } int s; }; using F = void (*) (S); F foo () { return [] (auto val) { if (val.s != 1234) __builtin_abort (); }; } int main () { { volatile F f = foo (); f ({}); } if (c[0] + c[1] != c[2]) __builtin_abort (); }