https://issues.dlang.org/show_bug.cgi?id=21537
--- Comment #4 from [email protected] --- (In reply to Bolpat from comment #3) > How is a pointer to a function pointer morally different from a pointer to a > delegate or a pointer to a class object reference? It isn't. > If types T and S have a subtyping relationship like T ⊆ S, then const(T)* ⊆ > const(S)*; at least, this is the case when T and S are class types or when T > and S are delegate types, but fails when T and S are function pointer types. No, such implicit conversion for pointer are already rejected: class A {} class B : A {} alias SysFP = void function(); alias SafeFP = void function() @safe; alias SysDG = void delegate(); alias SafeDG = void delegate() @safe; void main() { { A a; B b; a = b; // Fine }{ A* ap; B* bp; ap = bp; // Error: cannot implicitly convert expression `bp` of type `B*` to `A*` }{ SafeFP safeFp; SysFP sysFp; sysFp = safeFp; // Fine }{ SafeFP* safeFpPtr; SysFP* sysFpPtr; sysFpPtr = safeFpPtr; // Error: cannot implicitly convert expression `safeFpPtr` of type `void function() @safe*` to `void function()*` }{ SafeDG safeDg; SysDG sysDg; sysDg = safeDg; // Fine }{ SafeDG* safeDgPtr; SysDG* sysDgPtr; sysDgPtr = safeDgPtr; // Error: cannot implicitly convert expression `safeDgPtr` of type `void delegate() @safe*` to `void delegate()*` } } --
