[Bug c++/126860] New: ICE when calling a function pointer data member with a qualified-id from a dependent base class template

"s.kimura.h41104 at gmail dot com via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.