[Issue 2740] Template Mixins do not work as advertised

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 8 10:42:57 PDT 2010


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



--- Comment #3 from David Simcha <dsimcha at yahoo.com> 2010-09-08 10:42:34 PDT ---
Oh yeah, doesn't happen for abstract classes either.  Looks like only the
interface vtbl info is wrong.

import std.stdio;

abstract class IFooable {
  abstract bool foo();
}

mixin template TFoo() {
  override bool foo() { return true; }
}

class Foo : IFooable {
  mixin TFoo;
  override bool foo() { return false; }
}

void go(IFooable p) {
  writeln(p.foo);
}

void main() {
  Foo p = new Foo();
  go(p);            // false
  writeln(p.foo);   // false
  IFooable i = p;
  writeln(i.foo);   // false
}

-- 
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