From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25052 invoked by alias); 14 Jan 2013 16:14:40 -0000 Received: (qmail 23764 invoked by uid 48); 14 Jan 2013 16:14:01 -0000 From: "jens.maurer at gmx dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55972] New: cannot access private member from lambda used in NSDMI Date: Mon, 14 Jan 2013 16:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jens.maurer at gmx dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg01193.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55972 Bug #: 55972 Summary: cannot access private member from lambda used in NSDMI Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: jens.maurer@gmx.net The following short translation unit shows the issue: class C { void f(); int j =3D 10; int i =3D [this]() { return this->j; }(); }; $ g++ -std=3Dc++11 x.cc=20 x.cc: In lambda function: x.cc:4:11: error: =E2=80=98int C::j=E2=80=99 is private x.cc:5:39: error: within this context Non-static data member initializers (and lambdas used therein) should be ab= le to access private members of their class.