[Issue 3127] New: 'unreachable code' warning destroys delegate literal type inference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 2 05:15:23 PDT 2009


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

           Summary: 'unreachable code' warning destroys delegate literal
                    type inference
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


D1 and D2. Compile with -w.
===========
void bar(real delegate(real) f) {    }

void foo() {
    return;
    assert(0);
}

void main() {
    bar( (real x){ return x; });
}
===========
Output with DMD1.045:
C:\dev>dmd -w bug
warning - bug.d(5): Error: statement is not reachable
bug.d(9): Error: function bug.bar (real delegate(real)) does not match
parameter
 types (int delegate(real x))
bug.d(9): Error: cannot implicitly convert expression (__dgliteral1) of type
int
 delegate(real x) to real delegate(real)

On DMD2.030, the type is 'void' instead:
C:\dev>dmd -w bug
warning - bug.d(5): Error: statement is not reachable
bug.d(9): Error: function bug.bar (real delegate(real) f) does not match
paramet
er types (void delegate(real x))
bug.d(9): Error: cannot implicitly convert expression (__dgliteral1) of type
voi
d delegate(real x) to real delegate(real)

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


More information about the Digitalmars-d-bugs mailing list