digitalmars.D.bugs - [Issue 16467] New: templated function default argument take into
- via Digitalmars-d-bugs (28/28) Sep 05 2016 https://issues.dlang.org/show_bug.cgi?id=16467
https://issues.dlang.org/show_bug.cgi?id=16467 Issue ID: 16467 Summary: templated function default argument take into account when not needed Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: lodovico giaretart.net CC: lodovico giaretart.net T identity(T)(T t = 0) { return t; } void main() { int i = identity(); // as expected string s = identity("hello"); // error: cannot implictly converto (0) // of type int to string } I would expect the default value to be completely discarded when the user supplies a value. --
Sep 05 2016