On Friday, 10 August 2018 at 13:05:24 UTC, Kagamin wrote:
Mixim template can only introduce declarations, not statements, a workaround is a lambda called in place.


mixin template test(A...){
        __gshared a = A;
        int dummy = (){ a++; return 0; }();
}

extern(C) void main(){
        mixin test!123;
}

Thanks, this work for me. my second example should be a dmd bug ? (ldc work)

Reply via email to