[Issue 20077] New: Bogus 'need this' for lambda used inside struct

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


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

          Issue ID: 20077
           Summary: Bogus 'need this' for lambda used inside struct
           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

This fails with 'function `S.test!((a) => a).test` need this to access member
test':

struct S {
    pragma(msg, test!(a => a));
}

int test(alias fn)() {
    return fn(3);
}

Clearly, a => a does not need access to `this` in S, and something's gone wrong
in the inference here.

--


More information about the Digitalmars-d-bugs mailing list