[Issue 19242] New: Strange inferencing by combination of template and lambda
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 12 16:10:06 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19242
Issue ID: 19242
Summary: Strange inferencing by combination of template and
lambda
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: zan77137 at nifty.com
This code doesn't work:
--------------
void foo(Ret)(Ret delegate(int) dg) { }
// Even though alias func is not specified,
// this is selected unnaturally.
// Also, if this function is commented out,
// the above function(foo(Ret)) is inferred.
void foo(alias func)(void delegate(string) dg) { }
void main()
{
foo(a => a + 1);
}
--------------
dmd -run main.d
--------------
main.d(11): Error: incompatible types for `(a) + (1)`: `string` and `int`
--
More information about the Digitalmars-d-bugs
mailing list