why mixin template can not inclulde statement;
learnfirst1
learnfirst1 at gmail.com
Fri Aug 10 13:10:29 UTC 2018
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)
More information about the Digitalmars-d-learn
mailing list