[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 12:00:14 UTC 2020


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

--- Comment #5 from kinke <kinke at gmx.net> ---
(In reply to Simen Kjaeraas from comment #4)
> > 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.

It should try to create a delegate and either fail or create one with a null
context. A function pointer can generally NOT be used to represent a method,
because the `this` pointer is special ABI-wise and can NOT be assumed to simply
be the first argument, so changing the signature to `void function(S*)` does
NOT work.

--


More information about the Digitalmars-d-bugs mailing list