digitalmars.D.bugs - [Issue 7441] New: interface allowes empty statics and replace of statics
- d-bugmail puremagic.com (66/66) Feb 05 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7441
- d-bugmail puremagic.com (16/16) Feb 05 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7441
- d-bugmail puremagic.com (8/8) Feb 05 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7441
http://d.puremagic.com/issues/show_bug.cgi?id=7441 Summary: interface allowes empty statics and replace of statics Product: D Version: D2 Platform: All OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dl.soluz gmx.net --- Comment #0 from dennis luehring <dl.soluz gmx.net> 2012-02-05 02:17:45 PST --- import std.stdio; interface itest { static void implemented_static() { writeln("static itest.implemented_static"); } // ok static void empty_static(); // missing implementation } class A: itest { // silently replaces the interface implementation - no warning/error? static void implemented_static() { writeln("static A.implemented_static"); }; // implements the empty static - error? static void empty_static() { writeln("static A.empty_static"); }; } class B: itest { // static becomes silently an method - no warning/error? void implemented_static() { writeln("(method) B.implemented_static"); } // static becomes silently an method - no warning/error? void empty_static() { writeln("(method) B.empty_static"); } } int main() { itest.implemented_static(); //itest.empty_static(); // error A.implemented_static(); A.empty_static(); itest a = new A(); a.implemented_static(); //a.empty_static(); // error B b = new B(); b.implemented_static(); b.empty_static(); return 0; } Tested with dmd2.0.57/Win32 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 05 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7441 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies gmail.com Resolution| |INVALID --- Comment #1 from yebblies <yebblies gmail.com> 2012-02-05 21:23:26 EST --- None of these things are bugs. Methods are allowed to have no body, the body can be provided in a different source/object file and this is resolved at link time. It is not illegal to shadow the name of a static function in a base class/interface. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 05 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7441 --- Comment #3 from yebblies <yebblies gmail.com> 2012-02-05 21:59:42 EST --- Yes. You can always open an enhancement request, but as C++ supports both these things it's unlikely they will change. (There may already be an enhancement request for the second point) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 05 2012