With DMD 2.066.0, this compiles with version=A or version=B, but noth with both simultaneously:
import std.typecons;
mixin template WorkingTypedef(string i,T,T init=T.init)/+if(...)+/{
mixin Typedef!(T,init);
mixin(`alias `~i~` =Typedef;`);
}
version(A) mixin WorkingTypedef!("Name2",int,2);
version(B) mixin WorkingTypedef!("Name1",int);
The code should compile in all three cases.
Comment #1 by robert.schadek — 2024-12-13T18:27:48Z