https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117042
Bug ID: 117042
Summary: internal compiler error: Segmentation fault in
tsubst(tree_node*, tree_node*, int, tree_node*)
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: yihan4845 at gmail dot com
Target Milestone: ---
The following illformed code crashes current gcc trunk. This code was generated
by a fuzzer.
Compiler Explorer: https://godbolt.org/z/bvzxP455G
Code:
template <class T>
struct Future {
explicit Future(T v);
template <class F>
auto call(F&& fn) -> decltype(v(T())) {}
template <class F>
auto then(F&& fn) -> decltype(call(fn)) {}
};
Future<int> f;
Stack dump:
0x283dbf5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x28515d5 internal_error(char const*, ...)
???:0
0xcd3068 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0xcd276d tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0xcf5edc instantiate_class_template(tree_node*)
???:0
0xb4b9a9 start_decl_1(tree_node*, bool)
???:0
0xb6e5cf start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
???:0
0xc954ca c_parse_file()
???:0
0xded089 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