www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22205] New: catch(Exception) not longer working in debug blocks

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 puremagic.com
          Reporter: frame86 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.

--
Aug 12