Just referring to a template parameter list containing a lambda can cause a compile error:
struct S {
int i = bug!(a => "b");
}
auto bug(fns...)() {
return fns.length; // this.__lambda2 has no value
}
Moving the assignment outside of S makes the error go away, so it might be DMD wants it to have a context pointer, which is unnecessary in this case.
Comment #1 by moonlightsentinel — 2020-06-05T12:39:31Z
This is actually a regression and worked in 2.061.
Digger:
commit 186d9f9e85d3a092b575dc657ac55bc29604b77d
Author: Walter Bright <[email protected]>
Date: Wed Mar 6 23:55:11 2013 -0800
dmd: Merge pull request #1722 from 9rnsr/fix9633
https://github.com/dlang/dmd/pull/1722
[REG2.063a] Issue 9633 - compiles trait wrongly returns true even when object method call actually does not compile
Comment #2 by robert.schadek — 2024-12-13T19:09:00Z