Hello. i need to enumerate all module variables of the given types (it's easy, this is not the question) and make list of only __gshared ones. of course, i'm talking about CTFE.
is there any hack/trick to determine if variable is __gshared? or if it
is a thread-local, for that matter?
i added 'isGShared' trait to my compiler, but i'm not expecting from
others to do the same. ;-)
the only hack i invented is this abomination:
int v0;
__gshared int v1;
enum isGShared(alias var) =
!__traits(compiles,
mixin("{auto a___ = function typeof("~var.stringof~
") () @safe { return "~var.stringof~"; };}"));
pragma(msg, isGShared!v0); // false
pragma(msg, isGShared!v1); // true
sure, it's very limited, and we must do alot of checks before using it.
it *SEEMS* to work, but i not tested it very well.
signature.asc
Description: PGP signature
