[Issue 20078] New: Multiple confusing error messages

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 23 19:58:23 UTC 2019


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

          Issue ID: 20078
           Summary: Multiple confusing error messages
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: simen.kjaras at gmail.com

These functions all have the same underlying issue :

struct S {
    int n;
    pragma(msg, fun1!(a => n));
    pragma(msg, fun2!(a => n));
    pragma(msg, fun3!(a => n));
}

// Error: value of this is not known at compile time
int fun1(Fn...)() {
    alias F = Fn[0];
    pragma(msg, F(0));
    return 0;
}

//  Error: this.__lambda2 has no value
int fun2(Fn...)() {
    pragma(msg, Fn[0](0));
    return 0;
}

// Error: function `foo.S.fun3!((a) => a).fun3` need this to access member fun3
int fun3(alias Fn)() {
    return Fn(0);
}

However, as indicated by the comments, the error messages are wildly different.

--


More information about the Digitalmars-d-bugs mailing list