[Issue 11774] New: Lambda argument to templated function changes its signature forever

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 19 06:53:51 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11774

           Summary: Lambda argument to templated function changes its
                    signature forever
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-12-19 18:53:48 MSK ---
This code should compile:
---
void f(T, R)(R delegate(T[]) del)
{
    T[] src;
    del(src);
}

void main()
{
    int[] delegate(int[]) del;
    f!int(del); // ok
    f!Object(a => a);
    f!int(del); // fails, line 12
}
---
main.d(12): Error: template main.f does not match any function template
declaration. Candidates are:
main.d(1):        main.f(T, R)(R delegate(Object[]) del)
main.d(12): Error: template main.f(T, R)(R delegate(Object[]) del) cannot
deduce template function from argument types !(int)(int[] delegate(int[]))
---

The issue is major as compiler errors are misleading and people don't expect
such "broken forever" behaviour.

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


More information about the Digitalmars-d-bugs mailing list