July 21, 2018 [Issue 19104] New: Multiple overload resolution match when using default arguments | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19104 Issue ID: 19104 Summary: Multiple overload resolution match when using default arguments Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: slavo5150@yahoo.com import std.stdio; void print(uint value, uint base = 10) { writeln("uint: ", value); } void print(int value, uint base = 10) { writeln("int: ", value); } void main() { print(10, 16); } Error: onlineapp.print called with argument types (int, int) matches both: onlineapp.d(3): onlineapp.print(uint value, uint base = 10u) and: onlineapp.d(8): onlineapp.print(int value, uint base = 10u) https://run.dlang.io/is/BjwO3N I don't think the overload is ambiguous here. `print(10, 16)` should call the `int` overload, and `print(10u, 16)` should call the `uint` overload. -- |
Copyright © 1999-2021 by the D Language Foundation