[Issue 14189] New: can't declare two identical function prototypes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 16 09:01:52 PST 2015


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

          Issue ID: 14189
           Summary: can't declare two identical function prototypes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: ketmar at ketmar.no-ip.org

this code fails to compile:

=== test.d ===
void foo ();
void foo ();
==============

but why? there is nothing wrong with declaring two identical *prototypes*.
compiler must forbid declaring two identical function *implementations* (i.e.
two functions with same signature and both with body), but there is no sense in
forbidding identical prototypes.

this also breaks win32 API headers ("oleauto.d", for example). and any other
project which declares prototypes more than once.

this will not help catching any bugs too, so it seems that this is just a
needless restriction.

--


More information about the Digitalmars-d-bugs mailing list