Bug 19104 – Multiple overload resolution match when using default arguments

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-07-21T09:27:02Z
Last change time
2024-12-13T18:59:40Z
Assigned to
No Owner
Creator
Mike Franklin
Moved to GitHub: dmd#19460 →

Comments

Comment #0 by slavo5150 — 2018-07-21T09:27:02Z
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.
Comment #1 by razvan.nitu1305 — 2018-09-28T13:22:36Z
I think that the real problem is that print(-10, 16) is still ambiguous.
Comment #2 by robert.schadek — 2024-12-13T18:59:40Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19460 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB