[Issue 11268] Cannot use non-constant CTFE pointer in an initializer
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jan 10 18:22:06 PST 2016
https://issues.dlang.org/show_bug.cgi?id=11268
Elie Morisse <syniurge at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |syniurge at gmail.com
--- Comment #7 from Elie Morisse <syniurge at gmail.com> ---
Still there:
struct A {
uint d;
}
immutable A abc = { 42 };
immutable(uint)* xyz = &abc.d;
----
Error: cannot use non-constant CTFE pointer in an initializer '&A(42u).d'
I need to initialize a global variable with the address of a global struct
variable member and the workaround to get past that error was to do it in a
static ctor but that's not great since this is inside a template mixin meant to
be used in tons of places.
Although I'm only interested in the address the CTFE interpreter always
"resolves" abc into the literal.
--
More information about the Digitalmars-d-bugs
mailing list