Cannot use local 'i' as parameter to non-global template
maik klein via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Nov 7 07:04:39 PST 2015
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.
More information about the Digitalmars-d-learn
mailing list