[Issue 21195] Delegate to method created without a `this` in certain contexts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 27 11:06:25 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21195

--- Comment #4 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
I don't disagree there is a bug here, only that I think it's an instance of
2672.

Let's say I want a pointer to the closeInactive function, but I will assign the
context later. Should I then have to instantiate a Client, grab the delegate,
null the context pointer, and destroy the Client instance before I have a
pristine function pointer for future use?

If 2672 is fixed (and it bloody well should be), hopefully registerTimer would
choke upon getting a void function(Client) instead of the expected void
delegate().


> it's the & operator -- it should fail when trying to create a delegate

But it's not trying to create a delegate. It's trying and succeeding at
creating a function pointer, which has the wrong signature due to issue 2672.

--


More information about the Digitalmars-d-bugs mailing list