https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124440
Bug ID: 124440
Summary: [reflection] non-static member function in class
member access
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
As found in bug 124331, the following should compile but it doesn't:
```
// { dg-do compile { target c++26 } }
// { dg-additional-options "-freflection" }
struct B { consteval virtual int fn() const { return 1; } };
struct D : B { consteval int fn() const override { return 2; } };
constexpr D d;
template<typename T, typename U>
void
f ()
{
static_assert(d.[:^^U::fn:]() == 2);
static_assert(d.[:^^D::fn:]() == 2);
static_assert(d.U::fn() == 2);
static_assert(d.D::fn() == 2);
static_assert(d.fn() == 2);
static_assert(d.[:^^T::fn:]() == 2);
static_assert(d.[:^^T:]::fn() == 1);
static_assert(d.T::fn() == 1);
static_assert(d.[:^^B::fn:]() == 2);
static_assert(d.[:^^B:]::fn() == 1);
static_assert(d.B::fn() == 1);
}
void
g ()
{
f<B, D>();
}
```