Hi!
This report is based on the forum thread: https://forum.dlang.org/thread/[email protected]
I'm currently investigating why I can not take the address of a static struct-element at compile time.
struct Foo{
int bar;
}
__gshared Foo foo;
void *foo_ptr = &foo; // Works
void *bar_ptr = &foo.bar; // Error: static variable `foo` cannot be read at compile time
The D-Compiler passes the relocation of *foo_ptr down to the linker, but relocations plus an offset seem to not work. If I'd have to guess I'd say that this is a side-effect of all member accesses possibly being function calls.
Comment #1 by robert.schadek — 2024-12-13T19:17:31Z