[Issue 10819] Implicit conversion error assigning one SortedRange to another when a function literal has been used

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 24 06:18:56 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=10819

Stewart Gordon <smjg at iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |smjg at iname.com
            Summary|Invalid comparison for      |Implicit conversion error
                   |equality of lambda          |assigning one SortedRange
                   |functions                   |to another when a function
                   |                            |literal has been used

--- Comment #10 from Stewart Gordon <smjg at iname.com> ---
You completely forgot to post the compiler output.  Here's what I get (DMD
2.065 Win32):

bz10189.d(8): Error: cannot implicitly convert expression (c) of type
SortedRange!(int[], (a, b) => a > b) to SortedRange!(int[], (a, b) => a > b)

But the two types are the same.

The same occurs when a D1-style function literal is used

----- bz10189a.d -----
void main() {
    import std.range;
    SortedRange!(int[], "a > b") a;
    SortedRange!(int[], "a > b") b;
    b = a;
    SortedRange!(int[], function bool(a, b) { return a > b; }) c;
    SortedRange!(int[], function bool(a, b) { return a > b; }) d;
    d = c;
}
----------
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd bz10189a.d
bz10189a.d(8): Error: cannot implicitly convert expression (c) of type
SortedRange!(int[], function bool(a, b)
{
return a > b;
}
) to SortedRange!(int[], function bool(a, b)
{
return a > b;
}
)
----------

--


More information about the Digitalmars-d-bugs mailing list