www.digitalmars.com         C & C++   DMDScript  

D - [BUG] tampletes and static operators!

Calling template classes static operator works when called using alias but
doesn't work
when calling it by the template instance name!

I have this class (short version)

class Array(T)
 private T[] myarray;
 static Array opCall(T[] a)
  return new Array(a);
 public this(in T[] array)
  myarray = array;

when i use it in code like this:

int[] numbers,numbers2;
numbers[0..3] = Array!(int)(numbers2[1..4]);

i get compiler error!
But this works:

numbers[0..3] = Array!(int).opCall(numbers2[1..4]);


alias Array!(int) ArrInt;
numbers[0..3] = ArrInt(numbers2[1..4]);

So i think that the first one should work too because it should be the same
if i
use Array!(int) or its alias ArrInt
Mar 23 2004