[Issue 15818] New: Multiple function declarations without definition cause ambiguity overloading error

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Mar 21 11:09:28 PDT 2016


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

          Issue ID: 15818
           Summary: Multiple function declarations without definition
                    cause ambiguity overloading error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: verylonglogin.reg at gmail.com

This code should compile:
---
void f(int); // line 1
void f(int);
void f(int);
void f(int);
void f(int); // line 5

void main()
{
    f(1); // line 9
}
---
main.d(9): Error: main.f called with argument types (int) matches both:
main.d(1):     main.f(int)
and:
main.d(5):     main.f(int)
---

If any declaration is converted to definition the code compiles.
Also note the error message only reports about the first and the last
declaration.

--


More information about the Digitalmars-d-bugs mailing list