From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11935 invoked by alias); 6 Jul 2014 20:15:36 -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 11851 invoked by uid 48); 6 Jul 2014 20:15:28 -0000 From: "abutcher at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61636] generic lambda "cannot call member function without object" Date: Sun, 06 Jul 2014 20:15: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.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: abutcher at gcc dot gnu.org 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: 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-07/txt/msg00314.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 --- Comment #5 from Adam Butcher --- In an attempt to get a reduced testcase, I've uncovered an ICE. With the extra "this->" qualification on the reference to 'f' below, the code compiles fine. Alternatively, if 'this' is explicitly captured, the unqualified member call works too. There is clearly something a bit odd going on in this area. struct X { template void f(T t) {} template void g(T t) { [&] (auto x) { f(x); } (t); } }; int main() { X x; x.g(2); } :10:10: internal compiler error: Segmentation fault f(x); ^ 0xb8926f crash_signal ../../gcc/toplev.c:337 0x95afe8 contains_struct_check ../../gcc/tree.h:2840 0x95afe8 size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*) ../../gcc/fold-const.c:1471 0x9d0f49 gimplify_compound_lval ../../gcc/gimplify.c:1998 0x9c89ae gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gimplify.c:7618 0x9d2808 gimplify_call_expr ../../gcc/gimplify.c:2432 0x9c8b37 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gimplify.c:7637 0x9cd306 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gimplify.c:5417 0x9c8bc2 gimplify_cleanup_point_expr ../../gcc/gimplify.c:5193 0x9c8bc2 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gimplify.c:8029 0x9cd306 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gimplify.c:5417 0x9ce1af gimplify_bind_expr ../../gcc/gimplify.c:1100 0x9c907e gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gimplify.c:7863 0x9cd306 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gimplify.c:5417 0x9cec36 gimplify_body(tree_node*, bool) ../../gcc/gimplify.c:8773 0x9cf236 gimplify_function_tree(tree_node*) ../../gcc/gimplify.c:8926 0x84d117 analyze_function ../../gcc/cgraphunit.c:650 0x84e3bb analyze_functions ../../gcc/cgraphunit.c:1028 0x84fc45 finalize_compilation_unit() ../../gcc/cgraphunit.c:2333 0x63bece cp_write_global_declarations() ../../gcc/cp/decl2.c:4647