template IsSame(T){
  template As(alias t){
    enum As = is(T : typeof(t));
  }
}
void main()
{
  int i;
  enum b = IsSame!int.As!(i);
}

Err:

Error: template instance As!(i) cannot use local 'i' as parameter to non-global template As(alias t) dmd failed with exit code 1
I don't understand the error message.

I also tried

template IsSame(T){
  enum As(alias t) = is(T : typeof(t));
}

Which results in

Error: template app.IsSame!int.As cannot deduce function from argument types !()(int), candidates are: source/app.d(50,8):
app.IsSame!int.As(alias t)

What am I doing wrong?

Ps: Also posted on SO https://stackoverflow.com/questions/33584130/cannot-use-local-i-as-parameter-to-non-global-template not sure where people usually ask questions about D.

Reply via email to