Thread overview
[Issue 18930] __ctfe fails to detect initialization of unions
Jun 01, 2018
Simen Kjaeraas
Dec 17, 2022
Iain Buclaw
June 01, 2018
https://issues.dlang.org/show_bug.cgi?id=18930

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE, diagnostic
                 CC|                            |simen.kjaras@gmail.com

--- Comment #1 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
Unions generally don't work in CTFE. This issue is actually just a case of a wrong error message - the correct error message is 'Error: reinterpretation through overlapped field array is not allowed in CTFE', as can be seen in this code:

union U
{
    int a;
    int b;
}

int fn()
{
    U u;
    u.a = 3;
    return u.b;
}

enum v = fn();

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
December 13
https://issues.dlang.org/show_bug.cgi?id=18930

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19442

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--