https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120274
Bug ID: 120274
Summary: internal compiler error: in tsubst_expr, at
cp/pt.cc:21618 since clang 10 using -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 similar to #117325, but that bug was tested on godbolt and just happened
in version 14.1, not in trunk.
```
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <typename Container>
void reverse_collection(Container &&r)
{
auto end = r.cend();
reverse_collection(forward_iterator<decltype(end)>(end));
}
int main()
{
vector<int> v{1};
reverse_collection(v);
}
```
```
<source>:9:55: internal compiler error: in tsubst_expr, at cp/pt.cc:21618
9 | reverse_collection(forward_iterator<decltype(end)>(end));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
0x293fa35 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x295d7a6 internal_error(char const*, ...)
???:0
0xada636 fancy_abort(char const*, int, char const*)
???:0
0xd291fd instantiate_decl(tree_node*, bool, bool)
???:0
0xd63812 instantiate_pending_templates(int)
???:0
0xbe8489 c_parse_final_cleanups()
???:0
0xe612c8 c_common_parse_file()
???:0
```
To quickly reproduce:
https://godbolt.org/z/1v7589evz