[Issue 16181] Overloading doesn't consider default arguments with regards to ambiguity

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 11 04:51:40 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=16181

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|---                         |INVALID

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
The default argument is treated as an argument.

While both functions match, then the "least as specialized" rule is applied:

  foo(a) can call foo(int a, int b = 2)

  foo(a, 2) cannot call foo(int a)

Therefore, foo(int a) is selected.

Not a bug.

--


More information about the Digitalmars-d-bugs mailing list