https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70832
Bug ID: 70832 Summary: move-assignment of lambdas calls copy-constructor for captures Product: gcc Version: 5.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: blaffablaffa at gmail dot com Target Milestone: --- Created attachment 38352 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38352&action=edit testcase, compile with -std=c++14 Testcase attached, which compiles and produces correct output with clang++ 3.7. Incorrect g++ diagnostic: [pisto@localhost ~]$ g++ -std=c++14 test.cpp test.cpp: In function ‘int main()’: test.cpp:18:12: error: use of deleted function ‘main()::<lambda()>& main()::<lambda()>::operator=(const main()::<lambda()>&)’ lambda = move(lambda_moved); //g++ tries to call copy constructor and fails, clang++ 3.7 works ^ test.cpp:16:37: note: a lambda closure type has a deleted copy assignment operator auto lambda = [test = move(data)]{}; ^