www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2357] New: compiler fails to choose an overload

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2357

           Summary: compiler fails to choose an overload
           Product: D
           Version: 2.019
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: snake.scaly gmail.com


The following code:

import std.string;
void main() {
  toString(5uL, 16);
  }

when compiled, produces this output:

dmd -c test.d

(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). --
Sep 11 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2357


svv1999 hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from svv1999 hotmail.com  2008-09-11 19:41 -------
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. 


-- 
Sep 11 2008