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

           Summary: Template Mixins do not work as advertised
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: andrew.live...@gmail.com


// As I understand TFM, all three calls to go() should be printing 'false'.

import std.stdio;

interface IFooable {
  bool foo();
}

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

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

class _Foo : IFooable {
  mixin TFoo;
}

class Foo2 : _Foo {
  bool foo() { return false; }
}

class Foo3 : IFooable {
  bool foo() { return false; }
}

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

void main() {
  Foo p = new Foo();
  Foo2 p2 = new Foo2();
  Foo3 p3 = new Foo3();
  go(p); // output is "true" <------- Why isn't this false?
  go(p2); // output is "false"
  go(p3); // output is "false"
}


-- 

Reply via email to