[Issue 16655] New: lambda with type alias parameter fails std.traits.isSomeFunction

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Nov 2 03:43:51 PDT 2016


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 at puremagic.com
          Reporter: nick at 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";

--


More information about the Digitalmars-d-bugs mailing list