http://d.puremagic.com/issues/show_bug.cgi?id=2789
Summary: Compiler allows for method with the same signature Product: D Version: 2.025 Platform: PC OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: bary...@smp.if.uj.edu.pl cclass A { int m() { return 1; } float m() { return 2.0; } } class B { int m() { return 1; } int m() { return 2; } } void main() { auto a = new A(); assert(a.m() == 1); auto b = new B(); assert(b.m() == 1); } /+ dmd -c bugcopy.d bugcopy.d(23): function bugcopy.A.m called with argument types: () matches both: bugcopy.A.m() and: bugcopy.A.m() bugcopy.d(25): function bugcopy.B.m called with argument types: () matches both: bugcopy.B.m() and: bugcopy.B.m() Exit 1 +/ Without main this program compiles without any warning or error. This connected with for example overloding over aliases/or const can lead to problems. class B { int m(S[] c) { return 1; } int m(invariant(S)[] c) { return 2; } } If S is already invariant, then this code is erratic, but compiler will not report it to user. --