[Issue 17325] New: alias this not tried on template instantiation failure

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 13 18:11:56 PDT 2017


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

          Issue ID: 17325
           Summary: alias this not tried on template instantiation failure
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: qs.il.paperinik at gmail.com

struct Array
{
    int[] arr;
    alias arr this;
}

void main()
{
    import std.algorithm : sort, SwapStrategy;
    Array a;
    sort(a); // fails
    sort!("a < b", SwapStrategy.unstable, int[])(a); // works
    sort(a.arr); // works
}

This is a major limitation for writing wrappers.

--


More information about the Digitalmars-d-bugs mailing list