xxxxxxxxxx
module app;
import std.traits : hasUDA;
enum uda;
int i;
struct Test
{
static int i;
}
// This function should search for @uda symbols and set them = 3
void test(alias Symbol)()
{
foreach( s; __traits( allMembers, Symbol))
{
mixin("alias tmp = " ~ s ~ ";");
static if (hasUDA!(tmp, uda))
{
tmp = 3;
}
}
}
int main (string[] args)
{
// This set global i var
test!app;
// Should this set static field Test.i?
test!Test;
assert(i == 3); // PASS
assert(Test.i == 3); // FAIL
return 0;
}