[Issue 3345] Static and nonstatic methods with the same name should be allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 30 09:08:23 UTC 2021


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

--- Comment #14 from Max Samukha <maxsamukha at gmail.com> ---
(In reply to Richard Cattermole from comment #13)
> Add @safe to your main function.
> 
> onlineapp.d(11): Error: `this` reference necessary to take address of member
> `foo` in `@safe` function `main`
> onlineapp.d(12): Error: `@safe` function `D main` cannot call `@system`
> function pointer `f`

Right, passing the context via the void* pointer makes a non-static function
type unsafe. It is still a distinct type from the corresponding static function
type because of that additional parameter.

I hope a variant of DIP1011 eventually gets through, but DIP1011 doesn't talk
about fixing types of member functions and closures. It does propose to fix
delegates' funcptr by introducing a properly typed alias.

--


More information about the Digitalmars-d-bugs mailing list