www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Template aliases not resolved

The compiler issues the error "no property 'Type' for type 'TypeList'"

Source:

     struct Empty {}

     template TypeList(T, R) {
         struct TypeList {
             alias T Type;
             alias R Rest;
         }
     }

     template TypeList(T) {
         struct TypeList {
             alias T Type;
             alias Empty Rest;
         }
     }

     template TypeList(T : Empty) {
         alias Empty TypeList;
     }

     template TypeList() {
         alias Empty TypeList;
     }

     template Print(_T : Empty) {
         void Print() {
         }
     }

     template Print(_T) {
         void Print() {
             typeid(_T.Type).print();
             .Print!(_T.Rest)();
         }
     }

     alias TypeList!(int,
         TypeList!(float,
         TypeList!(char,
         Empty))) TL;

     int main() {
         Print!(TL)();
         return 0;
     }

  -- andy
Jun 23 2004