www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Previous Definition Different - typelist

[DMD 0.86] The following code brings "Previous Definition Different" 
linker error:

[code]

[typelist.d]
template Tfoo(int x, alias T) {
    void Tfoo(int a) {
      T(a);
    }
}
template Tbar(int x, alias T) {
    void Tbar(int a) {
      T(a);
    }
}
template Tend() {
    void Tend(int a) { }
}

[mainmod1.d]
import typelist;
void foobar1() {
    alias
      Tfoo!(1,
        Tbar!(2,
          Tend!()
        )
      ) t_foobar1;
}

[mainmod2.d]
import typelist;
void foobar2() {
    alias
      Tfoo!(1,
        Tbar!(3,
          Tend!()
        )
      ) foobar;
}

[main.d]
import mainmod1, mainmod2;
void main() {
    foobar1();
    foobar2();
}

[/code]

I tried:
    dmd main mainmod1 mainmod2
    dmd main mainmod1 mainmod2 typelist

Error is generated when Tbar instances are different in typelist.
If they are equals, although Tfoo instances are different, all is ok.
Apr 28 2004