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

            Bug ID: 120037
           Summary: Structured binding ICE
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

namespace std {
  template <typename T> struct tuple_size;
  template <int, typename> struct tuple_element;
}
struct T { int a[3]; };
namespace std {
template <>
struct tuple_size<T> { static constexpr int value = 3; };
template <int N>
struct tuple_element<N, T> { typedef int type; };
}

template <int N>
void
baz ()
{
  T t = { { 1, 2, 3 } };
  auto [ta, tb, tc] = t;
}

ICEs since r7-4511-g70f40fea6a317d when structured bindings have been
implemented.

/opt/notnfs/gcc-bisect/obj/gcc/cc1plus.r16-304 -quiet decomp18.C -fpermissive
decomp18.C: In function ‘void baz()’:
decomp18.C:18:9: warning: there are no arguments to ‘get’ that depend on a
template parameter, so a declaration of ‘get’ must be available [-fpermissive]
   18 |   auto [ta, tb, tc] = t;
      |         ^~
decomp18.C:18:23: internal compiler error: Segmentation fault
   18 |   auto [ta, tb, tc] = t;
      |                       ^
0x3079199 internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:517
0x11d0296 crash_signal
        ../../gcc/toplev.cc:321
0x8611db lvalue_kind(tree_node const*)
        ../../gcc/cp/tree.cc:304
0x86157d real_lvalue_p(tree_node const*)
        ../../gcc/cp/tree.cc:364
0x8615ae lvalue_p(tree_node const*)
        ../../gcc/cp/tree.cc:376
0x5504e8 cp_finish_decomp(tree_node*, cp_decomp*, bool)
        ../../gcc/cp/decl.cc:10063

Reply via email to