Hi!
I'm currently investigating why I can not take the address of a
static struct-element at compile time (afaik the linker should be
able to resolve this, and doing the identical thing in C works...)
```d
struct Foo{
ubyte bar;
}
__gshared Foo foo;
void* baz = \&foo; //works
void* bar = \&foo.bar; //Error: static variable `foo` cannot be
read at compile time
```
Does this have to do with ".bar" potentially being a function
call?
How does one get the address of a struct member?
The higher level problem of this question is that I want to make
a pointer-map of a struct:
```d
import std.meta;
struct Foo{
ubyte a;
ushort b;
}
template ptrize(alias S){
enum ptrize = \&S;
}
__gshared Foo f;
static immutable void*[] map = [staticMap!(ptrize, f.tupleof)];
```
Is there an alternative to get to this point? Static module
initializers are not really an option, since the whole thing
should be -betterC.
Thanks for any hints!