www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17325] New: alias this not tried on template instantiation

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 puremagic.com
          Reporter: qs.il.paperinik 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.

--
Apr 13