[Issue 22154] Pure functions should be able to use only the address of a global

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 29 04:37:51 UTC 2021


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

kinke <kinke at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke at gmx.net

--- Comment #4 from kinke <kinke at gmx.net> ---
> Putting the address in an enum appears to work:

As does making the global immutable:

pure int fun(int* x) {
    static immutable int a;
    if (x == &a) return 1;
    return 42;
}

--


More information about the Digitalmars-d-bugs mailing list