digitalmars.D.bugs - [Issue 2789] New: Compiler allows for method with the same signature
- d-bugmail puremagic.com Apr 03 2009
- d-bugmail puremagic.com Apr 15 2009
- d-bugmail puremagic.com Jan 31 2010
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: bugzilla digitalmars.com ReportedBy: baryluk 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. --
Apr 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2789 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com Keywords| |accepts-invalid OS/Version|Linux |All ------- Comment #1 from smjg iname.com 2009-04-15 11:08 ------- This was a bug in the D1 line ages ago - it seems for some reason the fix wasn't applied to the D2 line. BTW no classes are needed to show the bug - it happens with global functions just as well. --
Apr 15 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2789 --- Comment #2 from Witold Baryluk <baryluk smp.if.uj.edu.pl> 2010-01-31 09:04:23 PST --- (In reply to comment #1)This was a bug in the D1 line ages ago - it seems for some reason the fix wasn't applied to the D2 line. BTW no classes are needed to show the bug - it happens with global functions just as well.
Hmm. You are right, global functions also have this problem. The problem is that if you don't use this functions, and they have different return types, even linker will not give you any error. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 31 2010









d-bugmail puremagic.com 