http://d.puremagic.com/issues/show_bug.cgi?id=5827

           Summary: Invalid implicit cast from "int function() ref" to
                    "int function"
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2011-04-10 01:10:06 PDT ---
The following invalid D code is accepted by DMD:

import std.stdio;

int a=0;
ref int g(){
    writeln("called g");
    return ++a;
}

void main(){
    int function() f=&g; //this should issue an error!
    writeln(cast(int)&a);
    writeln(f());
}

Output:
-144939256
called g
-144939256

(&g is implicitly cast to "int function() ref", after that, the identical
calling conventions for "ref int" (int*) and int result in an implicit
reinterpret-cast from "ref int" to int.)

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

Reply via email to