https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93740

--- Comment #5 from m.cencora at gmail dot com ---
I think I was able to narrow it down to the true root cause. Following fails in
all gcc versions that supports C++11 and newer:

struct foo
{
    void baz();
    void bar();
};

static_assert(&foo::baz != &foo::bar, "");

You may ask why I think so, because when we compile following code with
-std=c++17 in gcc6.x, gcc7.x or gcc8.x:
struct foo
{
    void baz();
    void bar();
};

constexpr auto foo_baz()
{
    return &foo::baz;
}

constexpr auto foo_bar()
{
    return &foo::bar;
}

template <void (foo::*)()>
struct member_fun_ptr;

using member_foo_baz = member_fun_ptr<foo_baz()>;
using member_foo_bar = member_fun_ptr<foo_bar()>;

we get following errors:
<source>:20:48: error: 'void (foo::*)(){foo::baz, 0}' is not a valid template
argument for type 'void (foo::*)()'
 using member_foo_baz = member_fun_ptr<foo_baz()>;
                                                ^
<source>:20:48: note: it must be a pointer-to-member of the form '&X::Y'
<source>:21:48: error: 'void (foo::*)(){foo::bar, 0}' is not a valid template
argument for type 'void (foo::*)()'
 using member_foo_bar = member_fun_ptr<foo_bar()>;

which indicates that both &foo::baz and &foo::bar both have value '0' in
compile time, which is certainly not correct (and that is most likely why we
get "ambiguous base class" error in the example from comment#1).

Reply via email to