From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13973 invoked by alias); 23 Mar 2013 16:06:42 -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 13917 invoked by uid 48); 23 Mar 2013 16:06:35 -0000 From: "frankhb1989 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56699] New: Failed for sizeof (non-static member) in lambda expression Date: Sat, 23 Mar 2013 16:06: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: frankhb1989 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-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-03/txt/msg01654.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56699 Bug #: 56699 Summary: Failed for sizeof (non-static member) in lambda expression Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: frankhb1989@gmail.com Here are the minimal testcases: Case 1: struct A { int a; }; struct T { int x; T() : x([]{ sizeof(::A::a); return 0; }()) {} }; Case 2: struct A { int a; }; void f() { []{sizeof(A::a);}; } Tested at coliru.stacked-crooked.com (g++ -v shows it's a x86-64 linux host): Case 1: $ g++-4.8 -fsyntax-only -std=c++11 main.cpp main.cpp: In lambda function: main.cpp:11:15: error: type 'A' is not a base type for type 'T' sizeof(::A::a); ^ Case 2: $ g++-4.8 -fsyntax-only -std=c++11 main.cpp main.cpp: In lambda function: main.cpp:10:15: internal compiler error: Segmentation fault []{sizeof(A::a);}; ^ I have exactly the same errors for both cases using mingw-builds 4.8.0(i686-w64-mingw32) compiled today from sf.net on my Win7 x64 host. >>From some others, I've heard Case 1 is accepted by g++-4.8 compiled just now on Ubuntu12.04, but the ICE still exists for Case 2. G++ 4.7 accepts both cases.