www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16655] New: lambda with type alias parameter fails

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

          Issue ID: 16655
           Summary: lambda with type alias parameter fails
                    std.traits.isSomeFunction
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: nick geany.org

The static asserts below fail:

struct Color {struct Red {}}

unittest {
    import std.traits;

    alias ls = (string) => "string";
    static assert(isSomeFunction!ls);

    with (Color) {
        alias lc = (Red) => "red";
        static assert(isSomeFunction!lc);
    }
}

If you define ls, lc like this it works:

alias ls = (immutable(char)[]) => "string";
alias lc = (Color.Red) => "red";

--
Nov 02 2016