[Issue 22921] New: ImportC: initializing local with address of itself does not work in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 24 18:29:43 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22921

          Issue ID: 22921
           Summary: ImportC: initializing local with address of itself
                    does not work in CTFE
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

This does not compile:

struct S
{
    struct S *s;
    int first;
    int *last;
};

int main()
{
    struct S localS =
    {
        &localS,
        0,
        &localS.first
    };

    assertImpl(localS.s == &localS);
    assertImpl(localS.first == 0);
    assertImpl(localS.last == &localS.first);
    return 0;
}

_Static_assert(main() == 0, "Test");

--


More information about the Digitalmars-d-bugs mailing list