www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Template and alias can't be used the same way

Experimenting with a feature i heared about today i got to this
non-working code:
import std.c.stdio;

template sum(T)
     T sum(T[] x)
          T z;
          for(int i=0;i<x.length;i++)
          return z;

alias sum!(int) sumint;

int main ( char [] [] args )
 static int[] ints=[1,2,3,4,5];
 printf("Sum = %d\n",ints.sumint());
 printf("Sum = %d\n",ints.sum!(int)());    //this doesn't work
 printf("Sum = %d\n",sum!(int)(ints));

 return 1;

if I write
alias sum!(int) sumint;
"ints.sumint()" and "ints.sum!(int)()" should be the same!
May 17 2004