https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117511
Bug ID: 117511
Summary: internal compiler error: Segmentation fault at
mark_used(tree_node*, int)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: yihan4845 at gmail dot com
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/KnW9jY9hM
The following program:
```cpp
template<unsigned N> struct S { };
template<typename T>
class A {
static char check(S<sizeof(U(0))>);
public:
static const bool value = (sizeof(check<T>(0)) == sizeof(char));
};
void foo() {
A<int>::value;
}
```
will trigger segmentation fault for gcc trunk.
Stack dump:
```
0x289ac95 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x28b1685 internal_error(char const*, ...)
???:0
0xcc84b6 instantiate_decl(tree_node*, bool, bool)
???:0
0xb9380b mark_used(tree_node*, int)
???:0
0xd2e5ab finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
???:0
0xca0a6a c_parse_file()
???:0
0xdfab69 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```