https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636

--- Comment #5 from Adam Butcher <abutcher at gcc dot gnu.org> ---
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 <typename T>
     void f(T t) {}

     template <typename T>
     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

Reply via email to