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

            Bug ID: 85209
           Summary: [8 Regression] ICE with lambda and structured binding
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet (compiled with "-std=c++17") triggers
an ICE on trunk:

===========================
template<int> void foo()
{
  auto [a] = []{};
};

void bar()
{
  foo<0>();
}
===========================

bug.cc: In instantiation of 'void foo() [with int <anonymous> = 0]':
bug.cc:8:10:   required from here
bug.cc:3:8: internal compiler error: in tsubst_decomp_names, at cp/pt.c:16223
   auto [a] = []{};
        ^~~
0x6456bb tsubst_decomp_names
        ../../gcc/gcc/cp/pt.c:16223
0x974695 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16403
0x971764 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16264
0x96f15f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16561
0x96e2f8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16249
0x96e2f8 instantiate_decl(tree_node*, bool, bool)
        ../../gcc/gcc/cp/pt.c:23659
0x9932db instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:23775
0x8b893b c_parse_final_cleanups()
        ../../gcc/gcc/cp/decl2.c:4724
Please submit a full bug report, [etc.]

The regression was introduced between 2017-08-19 and 2017-09-02.
Before, the code was correctly rejected:

bug.cc: In instantiation of 'void foo() [with int <anonymous> = 0]':
bug.cc:8:10:   required from here
bug.cc:3:8: error: cannot decompose lambda closure type 'foo() [with int
<anonymous> = 0]::<lambda()>'
   auto [a] = []{};
        ^~~

Reply via email to