[Issue 11125] New: UFCS instantiation of template causes template constraint to be skipped

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 25 12:55:32 PDT 2013


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

           Summary: UFCS instantiation of template causes template
                    constraint to be skipped
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-09-25 12:55:29 PDT ---
-----
import std.traits;

template filter(alias predfun)
    if (is(ReturnType!predfun == bool))
{
    static assert(is(ReturnType!predfun == bool));
    auto filter(Range)(Range r) { }
}

void main()
{

    filter!((int a) => a + 1)([1]);  // fails in constraint
    [1].filter!((int a) => a + 1);   // fails internally in static assert!
}
-----

The bug seems to be fixed in 2.064 git-head, but I can't recall if I've seen it
filed as a bug. Is this a duplicate? We should make sure this test-case gets
added if the bug wasn't fixed on purpose.

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