https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120876
Bug ID: 120876
Summary: internal compiler error: Segmentation fault
finish_id_expression
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: ---
Program:
```
#include <iostream>
template<typename T>
class IsCharArrayNew{
private:
static auto
Test(decltype(ArrayRef(static_cast<T*>(nullptr))))->std::true_type;
public:
static constexpr bool value=decltype(Test(0))::value;
};
int main()
{
std::cout<<IsCharArrayNew<int>::value;
}
```
Stack dump:
```
<source>:7:46: internal compiler error: Segmentation fault
7 | static constexpr bool value=decltype(Test(0))::value;
| ~~~~^~~
0x2844425 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x2866fc6 internal_error(char const*, ...)
???:0
0xd4bb3d tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0xd6e87d instantiate_decl(tree_node*, bool, bool)
???:0
0xbf91c8 mark_used(tree_node*, int)
???:0
0xda9b84 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned long)
???:0
0xd166e3 c_parse_file()
???:0
0xe7e469 c_common_parse_file()
???:0
```
To quickly reproduce:
https://godbolt.org/z/16vxjhaPP