https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93740
--- Comment #3 from m.cencora at gmail dot com ---
Still broken in gcc 10.2 and trunk, also in C++20 mode.
The problem seems to show up only when address of member function (virtual or
not) is passed as template parameter - only then gcc fails during overload
resolution.
For free functions this works fine.
struct A
{
void foo();
void bar();
};
template <int N, auto val>
struct indexed_elem{};
struct A_indexed_member_funcs
: indexed_elem<0, &A::foo>,
indexed_elem<1, &A::bar>
{};
template <auto val, int N>
constexpr int index_of(indexed_elem<N, val>)
{
return N;
}
void foo();
void bar();
struct indexed_free_funcs
: indexed_elem<0, &foo>,
indexed_elem<1, &bar>
{};
void test()
{
// this fails due to gcc claim of ambiguous base classes
static_assert(index_of<&A::foo>(A_indexed_member_funcs{}) == 0, "");
// this is ok
static_assert(index_of<&foo>(indexed_free_funcs{}) == 0, "");
}