Getting the address of a member function at compile time inside a member function
user1234
user1234 at 12.de
Sun Jul 6 01:28:16 UTC 2025
On Sunday, 6 July 2025 at 01:25:18 UTC, user1234 wrote:
> On Sunday, 6 July 2025 at 01:10:16 UTC, Steven Schveighoffer
> wrote:
>> What about just asking for the `funcptr`?
>>
>>
>> ```d
>> static void funciont() fn = &foo.funcptr;
>> ```
>>
>> Nope, still the same error. I tried some other stuff, and it
>> also told me it cannot evaluate `funcptr` at compile time.
>
> You'll hate my answer but actually that was almost that, you
> forgot the parens
>
> ```d
> auto fn = (&foo).funcptr;
> ```
Sorry it's run-time... same error with static as storage class.
More information about the Digitalmars-d
mailing list