Implement P0018R3, C++17 lambda capture of *this by value as [=,*this]
commit66108a572631bc8d927f59bd3366397d59dbcda9
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Sep 2016 19:10:38 +0000 (27 19:10 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Sep 2016 19:10:38 +0000 (27 19:10 +0000)
tree2ca31d880419a194ebf4e7a0fe6a924476ebc7ab
parentce7e2f0ef405e1880f3070b46ebcf3f1b17e0020
Implement P0018R3, C++17 lambda capture of *this by value as [=,*this]
* parser.c (cp_parser_lambda_introducer): Formatting fix.  Pass
true instead of false as by_reference_p to add_capture for 'this'.
Parse '*this' simple-capture.
* lambda.c (build_capture_proxy): Handle '*this' capture by value.
(add_capture): Adjust function comment.  For id == this_identifier,
treat by_reference_p as capturing '*this' by reference, i.e. 'this'
by value, and !by_reference_p as capturing '*this' by value.
(add_default_capture): For implicit 'this' capture, always pass
by_reference_p true rather than false.

* g++.dg/cpp1z/lambda-this1.C: New test.
* g++.dg/cpp1z/lambda-this2.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240556 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/lambda.c
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/lambda-this1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/lambda-this2.C [new file with mode: 0644]