This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70832] New: move-assignment of lambdas calls copy-constructor for captures
- From: "blaffablaffa at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 27 Apr 2016 21:49:31 +0000
- Subject: [Bug c++/70832] New: move-assignment of lambdas calls copy-constructor for captures
- Auto-submitted: auto-generated
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)]{};
^