[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 08:37:13 UTC 2020


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

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |simen.kjaras at gmail.com
         Resolution|---                         |DUPLICATE

--- Comment #2 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
The issue here is not what you think. 'callback' is a function, not a delegate,
and &S.func is indeed a function. This is hinted at by the error message saying
"cannot implicitly convert expression &s.func of type void delegate() to void
function()".

Now, it can certainly be argued that the type of &S.func should be void
function(S), but for some reason it is not, and this has been a known issue
(issue 2672) for at least 11 years.

*** This issue has been marked as a duplicate of issue 2672 ***

--


More information about the Digitalmars-d-bugs mailing list