October 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11207

           Summary: improve implicit conversions of function
                    pointers/delegates
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: eberhardhoepfner@gmx.de


--- Comment #0 from Eberhard <eberhardhoepfner@gmx.de> 2013-10-09 08:03:07 PDT ---
class A {}
class B : A {}
B foo(const A) { return null; }
void main() {
    A function(const A)     f1 = &foo;  // compiles
    B function(A)           f2 = &foo;  // does not compile
    B function(immutable A) f3 = &foo;  // does not compile
    B function(B)           f4 = &foo;  // does not compile
}

test.d(6): Error: cannot implicitly convert expression (& foo) of type B
function(const(A) _param_0) to B function(A)
test.d(7): Error: cannot implicitly convert expression (& foo) of type B
function(const(A) _param_0) to B function(immutable(A))
test.d(8): Error: cannot implicitly convert expression (& foo) of type B
function(const(A) _param_0) to B function(B)


These implicit conversions should be possible. Explicit casting is too confusing and dangerous. If you make a mistake, you will end up with serious runtime errors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11207


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-10-10 06:51:00 PDT ---
*** This issue has been marked as a duplicate of issue 7725 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------