digitalmars.D.bugs - [Issue 16181] New: Overloading doesn't consider default arguments
- via Digitalmars-d-bugs (31/31) Jun 17 2016 https://issues.dlang.org/show_bug.cgi?id=16181
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: nobody puremagic.com Reporter: b.helyer gmail.com 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. --
Jun 17 2016