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

            Bug ID: 120151
           Summary: ICE in GCC when compiling a templated decltype with
                    incomplete lambda body with -std=c++20
           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: ---

It is interesting the fact that this ICE arises from the same program as
#120149 but removing a line, resulting in a totally different stack dump

```
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
template<class A, class B>
auto f(A a, B b)
        -> decltype(accumulate(begin(a), end(a), B{},
                [](B t, A i) -> B
                {
                }))
{
}
int main()
{
      vector<int> v;

      int i;
        f(v, i);

}
```

Stack dump 

```
internal compiler error: error reporting routines re-entered.
0x228730d diagnostic_context::report_diagnostic(diagnostic_info*)
        ???:0
0x2287465 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x229746e warning_at(rich_location*, diagnostic_option_id, char const*, ...)
        ???:0
0x884c40 finish_function(bool)
        ???:0
0x8bb3dc finish_lambda_function(tree_node*)
        ???:0
0x9b883b tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x9ab9bc tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x22a4c53 pretty_printer::format(text_info&)
        ???:0
0x22a6ed3 pp_verbatim(pretty_printer*, char const*, ...)
        ???:0
0x2296158 diagnostic_text_output_format::on_report_diagnostic(diagnostic_info
const&, diagnostic_t)
        ???:0
0x2287092 diagnostic_context::report_diagnostic(diagnostic_info*)
        ???:0
0x2287465 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x229746e warning_at(rich_location*, diagnostic_option_id, char const*, ...)
        ???:0
0x884c40 finish_function(bool)
        ???:0
0x99f62f instantiate_decl(tree_node*, bool, bool)
        ???:0
0x9c5b03 instantiate_pending_templates(int)
        ???:0
0x898b1a c_parse_final_cleanups()
        ???:0
0xa8b768 c_common_parse_file()
        ???:0

```

To quickly reproduce

https://gcc.godbolt.org/z/v5v37qhdo

Reply via email to