This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70832] New: move-assignment of lambdas calls copy-constructor for captures


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)]{};
                                     ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]