mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00

Start deprecation period of identical functions in a single module merged-on-behalf-of: unknown
33 lines
876 B
Text
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.
|