[Issue 10664] Win64: exception handling does not work with COMDAT folding

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 15 09:33:00 UTC 2020


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

--- Comment #5 from Walter Bright <bugzilla at digitalmars.com> ---
I.e. this works:

import core.exception;
import core.bitop;

Exception collectExceptionE(int delegate () expression, ref int result)
{
    try
    {
        result = expression();
    }
    catch (Exception e)
    {
        core.bitop.volatileLoad(cast(size_t*)Exception.classinfo); <*****
        return e;
    }
    return null;
}

RangeError collectExceptionR(int delegate () expression, ref int result)
{
    try
    {
        result = expression();
    }
    catch (RangeError e)
    {
        core.bitop.volatileLoad(cast(size_t*)RangeError.classinfo); <*****
        return e;
    }
    return null;
}

void main()
{
    int b;
    int foo() { throw new Exception("blah"); }
    assert(collectExceptionE(&foo, b));

    int[] a = new int[3];
    int goo() { return a[4]; }
    collectExceptionR(&goo, b);
}

--


More information about the Digitalmars-d-bugs mailing list