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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 19 17:40:41 UTC 2020


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

--- Comment #2 from Luís Ferreira <lsferreira169 at gmail.com> ---
This seems related to what's happening on #21332.

When type is explicitly known on the lambda, this doesn't happen. See this
snippet here:

```d
auto foobar(alias func)(string val)
{
    return func(val);
}

struct S {
    static immutable foo = "foo";
    static immutable bar = foobar!((string v) => v[0])(S.foo);
}
```

This is the exact same code snippet reported on the latest comment, but the
type of `v` is explicitly declared.

--


More information about the Digitalmars-d-bugs mailing list