[Issue 5710] New: cannot use delegates as parameters to non-global template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 6 06:29:38 PST 2011


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

           Summary: cannot use delegates as parameters to non-global
                    template
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-03-06 06:26:40 PST ---
This pretty severely impacts the usability of template alias parameters for
lambda functions.

class Foo {
    uint doStuff(alias fun)(uint a, uint b) { return fun(a, b); }
}

void main() {
    auto foo = new Foo;

    uint add(uint a, uint b) { return a + b; }

    foo.doStuff!add(1, 2);
}

test9.d(10): Error: template instance cannot use local 'add' as parameter to
non-global template doStuff(alias fun)

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