Thread overview |
---|
April 03, 2009 [Issue 2789] New: Compiler allows for method with the same signature | ||||
---|---|---|---|---|
| ||||
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. -- |
April 15, 2009 [Issue 2789] Compiler allows for method with the same signature | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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. -- |
January 31, 2010 [Issue 2789] Compiler allows for method with the same signature | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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: ------- |
January 29, 2012 [Issue 2789] Functions overloads are not checked for conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2789 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies@gmail.com Platform|x86 |All Version|2.025 |D2 AssignedTo|nobody@puremagic.com |yebblies@gmail.com Summary|Compiler allows for method |Functions overloads are not |with the same signature |checked for conflicts --- Comment #3 from yebblies <yebblies@gmail.com> 2012-01-30 02:25:12 EST --- The check for D2 was disabled because it didn't play nice with const, according to comments in FuncDeclaration::overloadInsert. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 29, 2012 [Issue 2789] Functions overloads are not checked for conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2789 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #4 from yebblies <yebblies@gmail.com> 2012-01-30 02:32:55 EST --- https://github.com/D-Programming-Language/dmd/pull/656 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 29, 2012 [Issue 2789] Functions overloads are not checked for conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2789 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |samukha@voliacable.com --- Comment #5 from yebblies <yebblies@gmail.com> 2012-01-30 02:34:28 EST --- *** Issue 1003 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 15, 2012 [Issue 2789] Functions overloads are not checked for conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2789 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |braddr@puremagic.com --- Comment #6 from yebblies <yebblies@gmail.com> 2012-02-15 14:37:33 EST --- *** Issue 895 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 20, 2013 [Issue 2789] Functions overloads are not checked for conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2789 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |thelastmammoth@gmail.com --- Comment #7 from yebblies <yebblies@gmail.com> 2013-08-21 00:53:15 EST --- *** Issue 10590 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation