[Issue 7441] New: interface allowes empty statics and replace of statics

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 5 02:17:48 PST 2012


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 at puremagic.com
        ReportedBy: dl.soluz at gmx.net


--- Comment #0 from dennis luehring <dl.soluz at 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: -------


More information about the Digitalmars-d-bugs mailing list