https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120757
Bug ID: 120757
Summary: ICE: in tsubst, at cp/pt.cc:16787
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rush102333 at gmail dot com
Target Milestone: ---
Starts from gcc-13: https://godbolt.org/z/r66becMsx
Test Input:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
template <typename> struct A
{
auto foo() {}
};
auto bar(void (A<int>::*)()) {}
template <int> auto baz()
{
bar(&A<int>::foo);
}
int main()
{
baz<0>();
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stack Dump:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>: In instantiation of 'auto baz() [with int <anonymous> = 0]':
<source>:15:9: required from here
15 | baz<0>();
| ~~~~~~^~
<source>:10:16: internal compiler error: in tsubst, at cp/pt.cc:16787
10 | bar(&A<int>::foo);
| ~~~~~~~~^~~
0x283a165 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x285b8f6 internal_error(char const*, ...)
???:0
0xae0346 fancy_abort(char const*, int, char const*)
???:0
0xd3cceb tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0xd5f9cd instantiate_decl(tree_node*, bool, bool)
???:0
0xbe93c3 maybe_instantiate_decl(tree_node*)
???:0
0xbeb137 mark_used(tree_node*, int)
???:0
0xb17e6e build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
???:0
0xd899dc finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0xd07873 c_parse_file()
???:0
0xe6f359 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~