Ok this is the thing that really gets me with CTFE: void printFields(T)(T t) { enum fields = [__traits(allMembers, T)];
foreach (string field; fields) { mixin("writeln(t." ~ to!string(field) ~ ");"); // fail mixin("writeln(t." ~ to!string(fields[0]) ~ ");"); // ok } } Even though the foreach loop will work, `field` can't be accessed. Once we have that working, its heaven.