www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15870] New: UFCS not recognized on array when passing as


          Issue ID: 15870
           Summary: UFCS not recognized on array when passing as alias
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ryan rcorre.net

Ordinarily, I don't have to slice an array to treat it as a range. However,
when passing it as template alias parameter, it seems like I do:

enum test(alias fun) = "it works";

immutable a = [1,2,3];

pragma(msg, test!(a[].map!(x => x))); // OK
pragma(msg, test!(a.map!(x => x)));   // map is not a member of a
pragma(msg, test!(map!(x => x)(a)));   // OK (no UFCS)

// but a.map does work at runtime ...
unittest {
    auto r = a.map!(x => x);

Apr 04 2016