https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94008
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Xuehan Xu from comment #0) > test_lambda([test_uniq = std::move(test_uniq)] { > test_lambda([test_uniq = std::move(test_uniq)] {}); The operator() of the closure object is a const member function, so test_uniq is const and can't be moved. Attempting to move it will copy it, which fails because unique_ptr is not copyable.