Bug 14189 – can't declare two identical function prototypes
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-02-16T17:01:00Z
Last change time
2015-02-16T20:43:17Z
Assigned to
nobody
Creator
ketmar
Comments
Comment #0 by ketmar — 2015-02-16T17:01:52Z
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.