Thread overview
[Issue 11268] Cannot use non-constant CTFE pointer in an initializer
Jan 11, 2016
Elie Morisse
Jun 03, 2019
Simen Kjaeraas
Feb 23, 2020
Dennis
Dec 17, 2022
Iain Buclaw
January 11, 2016
https://issues.dlang.org/show_bug.cgi?id=11268

Elie Morisse <syniurge@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |syniurge@gmail.com

--- Comment #7 from Elie Morisse <syniurge@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.

--
June 03, 2019
https://issues.dlang.org/show_bug.cgi?id=11268

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon.vanbernem@yahoo.de

--- Comment #8 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
*** Issue 19935 has been marked as a duplicate of this issue. ***

--
February 23, 2020
https://issues.dlang.org/show_bug.cgi?id=11268

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=20603

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=11268

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--