https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126860
Bug ID: 126860
Summary: ICE when calling a function pointer data member with a
qualified-id from a dependent base class template
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: s.kimura.h41104 at gmail dot com
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/96MvTzM94
Reproducer:
```
struct A {
int (*foo)();
};
template <typename T> struct S : public A {
void bar() { A::foo(); }
};
```
Backtrace:
<source>: In member function 'void S<T>::bar()':
<source>:6:19: internal compiler error: unexpected expression 'A::foo' of kind
field_decl
6 | void bar() { A::foo(); }
| ~~~^~~
0x2bb3918 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2ba855b internal_error(char const*, ...)
???:0
0xbb5dee cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
???:0
0xbb1f27 cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
???:0
0xc01978 cp_get_fndecl_from_callee(tree_node*, bool)
???:0
0xc025c1 convert_to_void(tree_node*, impl_conv_void, int)
???:0
0xe35081 finish_expr_stmt(tree_node*)
???:0
0xd99153 c_parse_file()
???:0
0xf2c6e9 c_common_parse_file()
???:0
This ICE goes back to gcc-14:
https://godbolt.org/z/PqbhMGnq4