https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94008
Nicholas Krause <xerofoify at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xerofoify at gmail dot com --- Comment #1 from Nicholas Krause <xerofoify at gmail dot com> --- I tried compiling this on both clang trunk and gcc trunk on godbolt. Your problem seems to be this: test_lambda([test_uniq = std::move(test_uniq)] { test_lambda([test_uniq = std::move(test_uniq)] {}); }) Your passing into std::move and then again. That's incorrect as your moving and moving again into the test_lamba. I tried with: test_lambda([test_uniq = test_uniq.get()]() mutable { test_lambda([test_uniq = std::move(test_uniq)] {}); }); And this does not miscompile due to test uniq getting the actual reference rather than the r value and going back into another r value reference. This therefore is not a bug.