http://d.puremagic.com/issues/show_bug.cgi?id=7542
Boscop <kingbos...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kingbos...@gmail.com --- Comment #4 from Boscop <kingbos...@gmail.com> 2012-03-09 10:46:41 PST --- (In reply to comment #2) > This pull breaks the type system: > > void main(){ > // conversion from void function(int*) to void function(inout(int)*): > void function(inout(int)*) wfp = function(int*)(*p = 1;} You can't do that because void function(int*) is a supertype of void function(inout(int)*). (as I described in comment 4 of bug 7543). One wants to be able to do: void fooM(int*); void fooC(const(int)*); void fooI(immutable(int)*); void function(const(int)*) wfp; wfp = &fooM; wfp = &fooC; wfp = &fooI; This is only possible when the following subtyping rules are obeyed: T <: const(T) immutable(T) <: const(T) And we also have: T* <: const(T)* immutable(T)* <: const(T)* ( And btw: T* <: const(T)* <: const(T*) immutable(T)* <: immutable(T*) <: const(T*) ) And of course the usual function subtyping rules (types of in-arguments are contravariant and types of out-arguments and return types are covariant). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------