[Issue 20298] New: Passing field alias to alias predicate doesn't work, predicate needs explicit instantiation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 13 17:25:04 UTC 2019
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 at puremagic.com
Reporter: dlang-bugzilla at 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
--
More information about the Digitalmars-d-bugs
mailing list