Date: Fri, 5 Jan 2024 10:23:19 -0500
On Fri, Jan 5, 2024 at 10:07 AM connor horman via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Member Function pointer can also be a vtable offset and a this adjustment. That cannot be converted to a function pointer w/o an object to resolve the vptr on. What do you propose happens in this case? A null pointer? Undefined behaviour?
The proposal being referenced (which BTW is *different* from the
proposal that Frederick is pushing) doesn't allow for polymorphism
with such function pointers. If you say `&SomeClass::member_function`,
the resulting function pointer *will* call the `SomeClass` version of
that function. And since it's consteval, its implementation is
irrelevant; the compile-time member function data structure can
contain whatever is needed to make this work.
<std-proposals_at_[hidden]> wrote:
>
> Member Function pointer can also be a vtable offset and a this adjustment. That cannot be converted to a function pointer w/o an object to resolve the vptr on. What do you propose happens in this case? A null pointer? Undefined behaviour?
The proposal being referenced (which BTW is *different* from the
proposal that Frederick is pushing) doesn't allow for polymorphism
with such function pointers. If you say `&SomeClass::member_function`,
the resulting function pointer *will* call the `SomeClass` version of
that function. And since it's consteval, its implementation is
irrelevant; the compile-time member function data structure can
contain whatever is needed to make this work.
Received on 2024-01-05 15:23:29