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

            Bug ID: 101595
           Summary: ICE: in tsubst_pack_expansion, at cp/pt.c:13124
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

template<class>
concept C = true;

auto apply(auto f, auto... args) {
  f(args...);
}

auto f(auto) {
  apply(
    [](auto... x) {
      ([] { if constexpr (C<decltype(x)>); }(), ...);
    }, 0);
}

int main() {
  f(0);
}

https://godbolt.org/z/eGjzePdf4

<source>: In instantiation of 'f<int>(int)::<lambda(auto:4 ...)> [with auto:4 =
{int}]':
<source>:5:4:   required from 'auto apply(auto:1, auto:2 ...) [with auto:1 =
f<int>(int)::<lambda(auto:4 ...)>; auto:2 = {int}]'
<source>:9:8:   required from 'auto f(auto:3) [with auto:3 = int]'
<source>:16:4:   required from here
<source>:10:12: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:13124
   10 |     [](auto... x) {
      |        ~~~~^~~~~
0x1d75749 internal_error(char const*, ...)
        ???:0
0x72daa7 fancy_abort(char const*, int, char const*)
        ???:0
0x9a9f67 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x9a9cb7 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x995c67 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x83defe maybe_instantiate_decl(tree_node*)
        ???:0
0x83f660 mark_used(tree_node*, int)
        ???:0
0x759055 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
        ???:0
0x9fc005 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0x995c67 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x83defe maybe_instantiate_decl(tree_node*)
        ???:0
0x83f660 mark_used(tree_node*, int)
        ???:0
0x754867 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x9fc18c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0x995c67 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x83defe maybe_instantiate_decl(tree_node*)
        ???:0
0x83f660 mark_used(tree_node*, int)
        ???:0
0x754867 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x9fc18c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0x95b245 c_parse_file()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.

Reply via email to