This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/78019] New: Local class with lambda in default member initializer cannot default-capture this
- From: "columbo at gmx-topmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 18 Oct 2016 11:23:30 +0000
- Subject: [Bug c++/78019] New: Local class with lambda in default member initializer cannot default-capture this
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78019
Bug ID: 78019
Summary: Local class with lambda in default member initializer
cannot default-capture this
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: columbo@gmx-topmail.de
Target Milestone: ---
int main() {
struct A {
int x, i = [&] { return x; }();
} a{0};
}
-----
> error: 'this' was not captured for this lambda function
Making the default-capture `=' doesn't help, but explicitly capturing `this'
works.