[Issue 17821] atomicStore compile error when target is larger than source

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 8 19:35:34 UTC 2021


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

Stanislav Blinov <stanislav.blinov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stanislav.blinov at gmail.com

--- Comment #3 from Stanislav Blinov <stanislav.blinov at gmail.com> ---
This compiles since 2.089.1:

void main() {
    import core.atomic;
    {
        shared ulong x = 0x1234_5678_8765_4321;
        atomicStore(x, 0);
        assert(x == 0);
    }
    {
        struct S
        {
            ulong x;
            alias x this;
        }

        shared S s;
        s = 0x1234_5678_8765_4321;
        atomicStore(s, S(0)); // note this is not atomicStore(s, 0);
        assert(s.x == 0);
    }
}

I'm not sure that atomicStore should even try alias this. This can probably be
closed as resolved now.

--


More information about the Digitalmars-d-bugs mailing list