October 13, 2019 [Issue 20298] New: Passing field alias to alias predicate doesn't work, predicate needs explicit instantiation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20298 Issue ID: 20298 Summary: Passing field alias to alias predicate doesn't work, predicate needs explicit instantiation Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P3 Component: dmd Assignee: nobody@puremagic.com Reporter: dlang-bugzilla@thecybershadow.net ///////////// test.d ///////////// struct S { int i; alias field = i; int fun(alias pred)() const { // Doesn't work: //return pred(field); // Works: alias ipred = pred!int; return ipred(field); } alias fun1 = fun!(i => i + 1); } ////////////////////////////////// Error is: test.d(9,14): Error: template `test.S.__lambda5` cannot deduce function from argument types `!()(const(int)) const`, candidates are: test.d(16,20): `__lambda5` test.d(16,15): Error: template instance `test.S.fun!((i) => i + 1)` error instantiating -- |
Copyright © 1999-2021 by the D Language Foundation