Bug 2357 – compiler fails to choose an overload

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-09-11T18:34:00Z
Last change time
2015-06-09T01:20:16Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
snake.scaly

Comments

Comment #0 by snake.scaly — 2008-09-11T18:34:45Z
The following code: import std.string; void main() { toString(5uL, 16); } when compiled, produces this output: >dmd -c test.d test.d(3): function std.string.toString called with argument types: (ulong,int) matches both: std.string.toString(long value, uint radix) and: std.string.toString(ulong value, uint radix) From my perspective the match is obvious. Marking this as rejects valid. The workaround is to call toString(5uL, 16u).
Comment #1 by svv1999 — 2008-09-11T19:41:50Z
Compiler acts according to the specs. On the second actual parameter both functions formal parameters match by implicit casting. This makes them belong to the same match priority. The fact that the first formal parameter of one function matches exact, is irrelevant.