digitalmars.D.bugs - [Issue 19242] New: Strange inferencing by combination of template
- d-bugmail puremagic.com (31/31) Sep 12 2018 https://issues.dlang.org/show_bug.cgi?id=19242
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 puremagic.com Reporter: zan77137 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` --
Sep 12 2018