www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19104] New: Multiple overload resolution match when using


          Issue ID: 19104
           Summary: Multiple overload resolution match when using default
           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)
onlineapp.d(8):     onlineapp.print(int value, uint base = 10u)


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.

Jul 21 2018