[Issue 22205] New: catch(Exception) not longer working in debug blocks

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 12 17:26:09 UTC 2021


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

          Issue ID: 22205
           Summary: catch(Exception) not longer working in debug blocks
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: frame86 at live.com

void f(T)(int num)
{
    import core.stdc.stdio;
    printf("recognized %d as %s\n", num, T.stringof.ptr);
}

void main()
{
    try
    {
        throw new Exception("");
    }
    catch (Exception)
    {
        f!Exception(1);
    }
    catch (Throwable)
    {
        f!Throwable(1);
    }

    debug
    {
        try
        {
            throw new Exception("");
        }
        catch (Exception)
        {
            f!Exception(2);
        }
        catch (Throwable)
        {
            f!Throwable(2);
        }
    }
}

prints:

recognized 1 as Exception
recognized 2 as Throwable

It seems that the catch-block is removed from the AST.

--


More information about the Digitalmars-d-bugs mailing list