[Issue 1978] Wrong vtable call

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 8 04:15:53 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1978


kamm-removethis at incasoftware.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code




------- Comment #3 from kamm-removethis at incasoftware.de  2008-04-08 06:15 -------
Further simplification:

extern(C) int printf(char*,...);

interface InterfaceB(T) : InterfaceA {}

interface InterfaceA{
  // changing return type to InterfaceA makes it work
  InterfaceB!(Object) func ();
}

class Foo(T) : InterfaceB!(T) {
  InterfaceB!(Object) func() {
    return null;
 }
}

void main() {
  auto foo = new Foo!(Object);

  // without this call, segfault is gone
  foo.func(); 
  printf("foo.func() call passed\n");

  InterfaceA ifA = foo;
  assert(ifA !is null);
  ifA.func(); // segfault
}


-- 



More information about the Digitalmars-d-bugs mailing list