From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2543 invoked by alias); 12 Apr 2014 19:37:06 -0000 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 Received: (qmail 2510 invoked by uid 48); 12 Apr 2014 19:37:02 -0000 From: "momchil.velikov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60463] Lambda function can call a non-const member function with const this Date: Sat, 12 Apr 2014 19:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: momchil.velikov at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg00918.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60463 Momchil Velikov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |momchil.velikov at gmail dot com --- Comment #1 from Momchil Velikov --- Just stumbled upon essentially the same problem with c++ (GCC) 4.10.0 20140412 (experimental) [master revision 094da06:e25c6c8:855372a3d3c40b76fed8ff368d37b77d14a488eb] #include struct S { void foo() const; void bar(); int x = 0; }; void S::foo() const { auto f = [&]() { bar(); }; f(); std::cout << x << std::endl; } void S::bar() { ++x; } int main() { S s; s.foo(); return 0; }