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

          Issue ID: 16181
           Summary: Overloading doesn't consider default arguments with
                    regards to ambiguity
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

The following code compiles:
---
int foo(int a, int b=2) {
    return a + b;
}

int foo(int a) {
    return a;
}

int main() {
    return foo(12);
}
---

The interaction between default arguments and overloading doesn't appear to be
documented, which should be rectified regardless, but isn't this ambiguous? The
above code is rejected by C++ compilers as 'ambiguous', and I would certainly
expect an error to be generated in this particular case.

--

Reply via email to