Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 10, 2012 [Issue 8366] New: Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8366 Summary: Overriding const member function in conjunction with mutable overload causes a strange error Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: blocker Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-09 21:26:12 PDT --- I think this problem blocks 2.060 release. code: ---- class C { // overrides Object.opEquals bool opEquals(const Object o) const {} // introduce mutable overload bool opEquals(const Object o) {} // line8 } void main(){} output: ---- test.d(8): Error: function test.C.opEquals multiple overrides of same function The second opEquals should *introduce* new member function. But, by the const attribute inference, it is determined as *multiple overrides". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 10, 2012 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 Benjamin Thaut <code@benjamin-thaut.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |code@benjamin-thaut.de --- Comment #1 from Benjamin Thaut <code@benjamin-thaut.de> 2012-07-09 22:01:38 PDT --- I reported the same issue with shared a while back, and it was stated that this is intentional. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 10, 2012 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-09 22:14:16 PDT --- Well, certainly for const, it's a _big_ problem. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 10, 2012 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-10 09:48:50 PDT --- https://github.com/D-Programming-Language/dmd/pull/1042 https://github.com/D-Programming-Language/druntime/pull/272 https://github.com/D-Programming-Language/phobos/pull/680 I think we must kill the attribute inference for 'const' attribute. It requires much compiler implementation cost against its little benefit. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 22, 2012 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 --- Comment #4 from github-bugzilla@puremagic.com 2012-11-21 20:37:45 PST --- Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/d57d808db194c3f1ee6af4d8251478309f0bab49 fix Issue 8366 - Overriding const member function in conjunction with mutable overload causes a strange error https://github.com/D-Programming-Language/druntime/commit/771c2a1503c91df79704277444c550ad463c590c Merge pull request #353 from 9rnsr/fix8366 Issue 8366 - Overriding const member function in conjunction with mutable overload causes a strange error -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 13, 2013 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com --- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-13 10:39:23 PST --- What's the state of this? I'm getting different error messages, such as: Deprecation: class test.C use of object.Object.opEquals(Object o) hidden by C is deprecated. Use 'alias Object.opEquals opEquals;' to introduce base class overload set. Is that ok? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 14, 2013 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 --- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-13 17:45:09 PST --- (In reply to comment #5) > What's the state of this? I'm getting different error messages, such as: > > Deprecation: class test.C use of object.Object.opEquals(Object o) hidden by C is deprecated. Use 'alias Object.opEquals opEquals;' to introduce base class overload set. > > Is that ok? No. In 2.060 release, all Object class method signatures are reverted, so the original code is not correct in current. More generic case is: class B { bool foo(in Object o) const { return true; } } class C : B { bool foo(in Object o) { return true; } // line 10 override bool foo(in Object o) const { return false; } // line 12 } void main() { C mc = new C(); const C cc = new C(); B mb = mc; const B cb = cc; assert(mc.foo(null) == true); assert(cc.foo(null) == false); assert(mb.foo(null) == false); assert(cb.foo(null) == false); } This code should compile but outputs: --- test.d(10): Deprecation: overriding base class function without using override attribute is deprecated (test.C.foo overrides test.B.foo) test.d(12): Error: function test.C.foo multiple overrides of same function Mutable foo in class C is incorrectly overrides const foo in class B. That is the bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 14, 2013 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 --- Comment #7 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-13 17:57:08 PST --- Ah I'm sorry, I haven't seen your comment here: http://d.puremagic.com/issues/show_bug.cgi?id=8366#c3 I saw github-bugzilla@puremagic.com posting and thought it was done, but there are 3 pulls. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 06, 2013 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 --- Comment #8 from github-bugzilla@puremagic.com 2013-03-06 15:05:44 PST --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/de9e8b3073aa3abc2bb93d5482a7dcbe66aab92c fix Issue 8366 - Overriding const member function in conjunction with mutable overload causes a strange error We MUST kill attribute inference with const. To implement it correctly without breaking overriding and overloading features, re-scanning and arrangement of vtbl entries is needed in the end of Classdeclaration::semantic, it will decrease compile speed. I think that is a big drawbacks than the benefit. https://github.com/D-Programming-Language/dmd/commit/2cab1b0c852e7f86f9553940ab8441c7efee31f4 Merge pull request #1042 from 9rnsr/fix8366 Issue 8366 - Overriding const member function in conjunction with mutable overload causes a strange error -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 07, 2013 [Issue 8366] Overriding const member function in conjunction with mutable overload causes a strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8366 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED -- 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