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

            Bug ID: 120595
           Summary: internal compiler error: in tsubst_stmt, at
                    cp/pt.cc:19111 since 7.1
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mario.rodriguezb1 at um dot es
  Target Milestone: ---

ICE on:

```
#include <tuple>
#include <functional>
#include <iostream>
struct Printer {
    template<typename... Args>
    void operator()(Args&&... args) {
        std::apply(
            [&args...](auto&&... args) {
                ([&args...](auto arg) {}(args), ...);
            },
            std::forward_as_tuple(args...));
    }
};
int main() {
    Printer{}(1, "foo", 0.5);
}
```

Stack dump

```
<source>:9:37: internal compiler error: in tsubst_stmt, at cp/pt.cc:19111
    9 |                 ([&args...](auto arg) {}(args), ...);
      |                                     ^
0x282f1c5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x284d556 internal_error(char const*, ...)
        ???:0
0xadeeec fancy_abort(char const*, int, char const*)
        ???:0
0xd56435 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd4fd54 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd5cafd instantiate_decl(tree_node*, bool, bool)
        ???:0
0xbe6aa3 maybe_instantiate_decl(tree_node*)
        ???:0
0xbe8817 mark_used(tree_node*, int)
        ???:0
0xb1b143 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
        ???:0
0xd86ece finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xc3a2bb build_invoke(tree_node*, tree_node const*, int)
        ???:0
0xd90ddd finish_trait_expr(unsigned long, cp_trait_kind, tree_node*,
tree_node*)
        ???:0
0xd44901 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd550a9 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd39acb tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd3a6c6 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd6850b instantiate_class_template(tree_node*)
        ???:0
0xd7767b lookup_member(tree_node*, tree_node*, int, bool, int,
access_failure_info*)
        ???:0
0xc935a9 lookup_qualified_name(tree_node*, tree_node*, LOOK_want, bool)
        ???:0
0xd5cafd instantiate_decl(tree_node*, bool, bool)
        ???:0
```

To quickly reproduce:

https://godbolt.org/z/TPboErzY8

Reply via email to