[Issue 8751] New: Problem with pure inference of inner delegate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 4 03:27:41 PDT 2012


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

           Summary: Problem with pure inference of inner delegate
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-10-04 03:21:21 PDT ---
alias bool delegate(in int) pure Bar;
Bar foo1(immutable scope int x) pure {
    return y => x > y; // OK
}
Bar foo2(const scope int x) pure {
    return y => x > y; // error
}
Bar foo3(in int x) pure {
    return y => x > y; // error
}
void main() {}



DMD 2.061alpha gives:

temp.d(6): Error: cannot implicitly convert expression (__lambda4) of type bool
delegate(const(int) y) nothrow @safe to bool delegate(const(int)) pure
temp.d(9): Error: cannot implicitly convert expression (__lambda6) of type bool
delegate(const(int) y) nothrow @safe to bool delegate(const(int)) pure


The 'x' arguments are values, and they can't be modified inside foo1/foo2/foo3,
so I think DMD should accept all three versions.

-- 
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