Thread overview | |||||
---|---|---|---|---|---|
|
August 19, 2010 [Issue 4679] New: Problem with final & override | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4679 Summary: Problem with final & override Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2010-08-19 06:22:41 PDT --- This D2 program compiles and runs with DMD 2.048 with no errors: import std.c.stdio: puts; class Base { this() { foo(); } private void foo() { puts("Base.foo"); } // called } class Derived : Base { private override void foo() { // not called puts("Derived.foo"); super.foo(); } } void main() { auto d = new Derived(); } Output: Base.foo If Base.foo() is private then it's final. Then what is Derived.foo() overriding? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 19, 2010 [Issue 4679] Problem with final & override | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4679 Jonathan M Davis <jmdavisProg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmail.com --- Comment #1 from Jonathan M Davis <jmdavisProg@gmail.com> 2010-08-19 15:39:49 PDT --- The fact that private has anything to do with final is arguably a bug. It certainly contradicts TDPL. The bug on that is http://d.puremagic.com/issues/show_bug.cgi?id=4542 Now, this is still a bug. Either dmd still makes private final, at which point overriding the method should be a bug, or it follows TDPL and does not make it final, at which point, the derived method should be called, which it isn't. So, this is a definitely a bug, but I'd favor fixing #4542 and make it call the derived method rather than making overriding the method an error. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 22, 2012 [Issue 4679] Problem with final & override | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4679 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich@gmail.com Resolution| |FIXED --- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-21 21:28:55 PDT --- Private methods are now final by default and OP sample errors. Whether or not that will change (probably not) depends on Issue 4542. -- 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