Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 04, 2008 [Issue 2389] New: void* vs. object type overloading fails | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2389 Summary: void* vs. object type overloading fails Product: D Version: 1.029 Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: shro8822@vandals.uidaho.edu one option is an exact match but it still fails? (adding a cast to void* fixes it) class C { void opIndexAssign(void*,int){} void opIndexAssign(C,int){} } void main() { C c = new C; c[0] = null; } Error: Line 10: function C.opIndexAssign called with argument types: (void*,int) matches both: C.opIndexAssign(void*,int) and: C.opIndexAssign(C,int) -- |
October 04, 2008 [Issue 2389] void* vs. object type overloading fails for null | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2389 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #1 from bugzilla@digitalmars.com 2008-10-04 00:56 ------- null is not a simple void* like it is in C. It exact matches several different types, including objects and void*. Hence the ambiguity. -- |
October 04, 2008 [Issue 2389] void* vs. object type overloading fails for null | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2389 ------- Comment #2 from bugzilla@digitalmars.com 2008-10-04 01:03 ------- I should add that this 'works' in D 2.0 because partial ordering is used to resolve overloading conflicts. -- |
October 04, 2008 [Issue 2389] void* vs. object type overloading fails for null giving bad error message | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2389 shro8822@vandals.uidaho.edu changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Keywords| |diagnostic Priority|P2 |P3 Resolution|INVALID | Summary|void* vs. object type |void* vs. object type |overloading fails for null |overloading fails for null | |giving bad error message ------- Comment #3 from shro8822@vandals.uidaho.edu 2008-10-04 14:56 ------- The error message leave a lot to be desired. Re-opening at low priority as a diagnostic bug. It should be fixed "sooner or later" even if it requiters tweaking the type system. Just like the "invalid expressions are of type null" thing. -- |
October 04, 2008 [Issue 2389] void* vs. object type overloading fails for null giving bad error message | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2389 ------- Comment #4 from shro8822@vandals.uidaho.edu 2008-10-04 15:37 ------- EDIT: <-Just like the "invalid expressions are of type null" thing. ->Just like the "invalid expressions are of type int" thing. -- |
May 05, 2012 [Issue 2389] void* vs. object type overloading fails for null giving bad error message | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2389 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |WORKSFORME --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2012-05-05 02:27:38 PDT --- Now produces: foo.d(10): Error: function foo.C.opIndexAssign called with argument types: ((typeof(null),int)) matches both: foo.C.opIndexAssign(void* _param_0, int _param_1) and: foo.C.opIndexAssign(C _param_0, int _param_1) -- 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