[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 00:40:28 UTC 2021


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

Nathan S. <n8sh.secondary at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |n8sh.secondary at hotmail.com

--- Comment #3 from Nathan S. <n8sh.secondary at hotmail.com> ---
Putting the address in an enum appears to work:

---

__gshared int a;

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

---

--


More information about the Digitalmars-d-bugs mailing list