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

           Summary: Delegate literals with nameless arguments fail to
                    infer a type
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagita...@gmx.de> 2012-01-02 05:07:52 
PST ---
Maybe this is an expected side-effect of more magic with delegate type
inference, but the latest dmd version from github causes errors with this code:

module test;

class Widget {}

void main()
{
    auto dg0 = delegate void(Widget w) { };  // OK
    auto dg1 = delegate void(Widget) { };  // error
    void delegate(Widget) dg2 = delegate void(Widget) { }; //OK
    void delegate(Widget) dg3;
    dg3 = delegate void(Widget) { foo(); }; //error
}

test.d(8): Error: cannot infer type from ambiguous function literal
__dgliteral2
test.d(8): Error: __dgliteral2 has no value
test.d(11): Error: __dgliteral6 has no value

This compiles with dmd 2.057.

I guess the trouble is that the delegate argument "Widget" is interpreted as a
parameter name, not the type. Using "int" instead of "Widget" compiles.

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

Reply via email to