Note that this occurs with gcc-11.4.0, gcc-12.3.0 and gcc-13.1.0, but does not occur with clang-15 or clang-16. The code causing this error is here: https://github.com/heal-research/operon/blob/2419a3f09383386379607717133027b02f18942c/include/operon/interpreter/dispatch_table.hpp#L180 The code tries to retrieve the N-1 types from a template parameter pack.
Note that I couldn't make an attachment due to file size restrictions (despite my attempts to compress the file), so I uploaded preprocessed source generated by -freport-bug here: https://gist.githubusercontent.com/foolnotion/ce9cf282cd398502bf84e394c0854022/raw/649658a6a3a085662cc37ad88fa2f4cab1438733/gcc-13.1.0.out
The ICE is the following but I see various error: template argument 2 is invalid errors too. /home/bogdb/src/operon-mdl-fix/include/operon/interpreter/dispatch_table.hpp:180:71: internal compiler error: Segmentation fault 0x1a1c1fc crash_signal /home/mpolacek/src/gcc/gcc/toplev.cc:314 0x7fb6968e2b1f ??? /usr/src/debug/glibc-2.36-9.fc37.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0xd1fcd0 tree_check(tree_node*, char const*, int, char const*, tree_code) /home/mpolacek/src/gcc/gcc/tree.h:3576 0x1045f31 template_parms_to_args(tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:4917 0x107670f tsubst_template_decl /home/mpolacek/src/gcc/gcc/cp/pt.cc:14784 0x1096ecb tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:20203 0x109eb78 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:21769 0x109af92 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:21082 0x1081785 tsubst(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:16693 0x1069f29 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:12622 0x106ee4c tsubst_template_args(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:13775 0x107048d tsubst_aggr_type_1 /home/mpolacek/src/gcc/gcc/cp/pt.cc:14049 0x107030e tsubst_aggr_type /home/mpolacek/src/gcc/gcc/cp/pt.cc:14019 0x1080ed3 tsubst(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:16579 0x1069f29 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:12622 0x106ee4c tsubst_template_args(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:13775 0x107048d tsubst_aggr_type_1 /home/mpolacek/src/gcc/gcc/cp/pt.cc:14049 0x107030e tsubst_aggr_type /home/mpolacek/src/gcc/gcc/cp/pt.cc:14019 0x1080ed3 tsubst(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:16579 0x1069f29 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:12622
Probably a dup of bug 105667.
The smallest I could get right now: ``` namespace std { typedef long unsigned int size_t; template <bool _Cond, typename _Iftrue, typename _Iffalse> struct conditional {}; template <bool _Cond, typename _Iftrue, typename _Iffalse> using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type; template <typename _Tp> inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value; template <typename... Ts> struct DispatchTable { using Typ = std::conditional_t<true, decltype([]<auto... Idx>(std::index_sequence<Idx...>) {}(std::make_index_sequence<sizeof...(Ts) - 1>{})), int>; template <typename T, auto SZ = std::tuple_size_v<Typ>> static auto constexpr TypeIndex = detail::TypeIndexImpl<T, Ts...>(); static constexpr typename Ext::value_type BatchSize = Sizes[TypeIndex<T>]; ``` The above is an ICE after errors but I suspect this is the same as the other decltype of a lambda issues too.