dmd/changelog/duplicate-implementations-deprecation.dd
Sebastian Wilzbach 2d0f122529
Start deprecation period of identical functions in a single module (#8429)
Start deprecation period of identical functions in a single module
merged-on-behalf-of: unknown
2020-09-22 19:41:00 +02:00

33 lines
876 B
Text

Diagnostics for conflicting function definitions within a module
Previously, multiple definitions of identical functions within a module were not
recognized, although they have the same mangling. This was problematic because a
binary cannot contain multiple definitions of a symbol, which caused undefined
behavior depending on the compiler backend.
DMD will now raise an error message if there are conflicting implementations
within a single module:
---
void foo() {}
void foo() {} // error
---
Multiple declarations are still allowed as long as there is at most one definition:
---
void bar(int);
void bar(int) { }
void bar(int);
---
DMD will issue a deprecation for mangling schemes that don't support overloading
(`extern(C|Windows|System)`):
---
extern(C):
void foo(int) { }
void foo(double) { } // deprecation
---
This deprecation will become an error in 2.105.