how to instantiate explicitly template parameters in struct A(T1){this(T2)(){...}}

Timothee Cour thelastmammoth at gmail.com
Mon May 13 20:34:39 PDT 2013


A)
The behavior of __ctor (whether or not documented) seems broken / unreliable:

struct A{this(T)(T x){}}

void fun(T){
  auto a=A.__ctor!(int)(1);
}
void main(){
  auto a=A.__ctor!(int)(1); //ok
  fun!int(); //Error: type A is not an expression
}


Is that a bug?

B)
Why not use 'this' instead of '__ctor', and make it documented (and
reliable, ie work in the above case) ?
I don't see how that could create ambiguity, and that would solve the
problem raised in this thread.


More information about the Digitalmars-d-learn mailing list