[Issue 20154] bad closure if local variables have larger alignment requirements

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 9 04:17:41 UTC 2020


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

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
A somewhat more illustrative test:


struct SpinLock
{
    align(64)
        int x;
}

void collectReferences(int x) //ref HashTab references)
{
    SpinLock lock = SpinLock(8); // dmd BUG: alignment causes bad capture!

    void mark() scope nothrow
    {
        assert(lock.x == 8);
        assert(x == 7);
    }

    mark();
}

void main()
{
    collectReferences(7);
}

--


More information about the Digitalmars-d-bugs mailing list