www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17870] New: recursive template "T is nested in both"

https://issues.dlang.org/show_bug.cgi?id=17870

          Issue ID: 17870
           Summary: recursive template "T is nested in both"
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: nicolas.jinchereau gmail.com

class B       { int a; }
class D1 : B  { int b; }
class D2 : D1 { int c; }

template TupleOf(Classes...)
{
    static if(Classes.length > 1)
        alias TupleOf = AliasSeq!(Classes[0].tupleof, TupleOf!(Classes[1..$]));
    else static if(Classes.length == 1)
        alias TupleOf = AliasSeq!(Classes[0].tupleof);
    else
        alias TupleOf = AliasSeq!();
}

int main(string[] argv)
{
    alias allClasses = AliasSeq!(D2, BaseClassesTuple!D2);
    alias allFields = TupleOf!allClasses;
    return 0;
}


Error: template instance AliasSeq!(b, a) AliasSeq!(b, a) is nested in both D1
and B
Error: template instance main.TupleOf!(D1, B, Object) error instantiating
instantiated from here: TupleOf!(D2, D1, B, Object)

--
Oct 01