this code give error:
static if( !__traits(compiles, mixin("enum v = V;")) ) {
enum v = V;
}
Error: static variable `NotWorkVar` cannot be read at compile time
V is alias get from typeof(__traits(getMember, M, symbol), M is module from importC.
the importC source "test.h" code for NotWorkVar
extern const float NotWorkVar;
I am try to static foreach(symbol; __traits(allMembers, importCModule)), and want to check if the symbol is static variable or not at compile time.
Permalink
Reply