www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14189] New: can't declare two identical function prototypes


          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 puremagic.com
          Reporter: ketmar 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.

Feb 16 2015