digitalmars.D.bugs - [Issue 2789] New: Compiler allows for method with the same signature
- d-bugmail puremagic.com (63/63) Apr 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2789
- d-bugmail puremagic.com (12/12) Apr 15 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2789
- d-bugmail puremagic.com (9/12) Jan 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2789
- d-bugmail puremagic.com (16/16) Jan 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2789
- d-bugmail puremagic.com (10/10) Jan 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2789
- d-bugmail puremagic.com (10/10) Jan 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2789
- d-bugmail puremagic.com (10/10) Feb 14 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2789
- d-bugmail puremagic.com (10/10) Aug 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=2789
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
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 09:04:23 PST ---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
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
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: -------
Jan 29 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2789
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
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: -------
Jan 29 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2789
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |samukha voliacable.com
*** 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: -------
Jan 29 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2789
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |braddr puremagic.com
*** 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: -------
Feb 14 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2789
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |thelastmammoth gmail.com
*** 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: -------
Aug 20 2013









d-bugmail puremagic.com 