try this:
mixin template test(A...){
__gshared int a = A[0];
int dummy = (){
a++;
return 0;
}();
}
import core.stdc.stdio;
int main(){
mixin test!1;
printf("a=%d\n", a);
return 0;
}