https://issues.dlang.org/show_bug.cgi?id=17760
Issue ID: 17760 Summary: catch block fails to catch Exception subclass when another Exception is in transit Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: hst...@quickfur.ath.cx Code: --------- import std.stdio; class MyException : Exception { this() { super("MYMY"); } } struct S { ~this() { try { throw new MyException; } catch(MyException e) { writefln("Collected MyException: %s", e.msg); } catch(Exception e) { writefln("Collected Exception: %s", e.msg); } } void method() { throw new Exception("Dumb error"); } } void main() { try { S s; s.method(); } catch(Exception) {} } --------- Expected output: --------- Collected MyException: MYMY --------- Actual output: --------- Collected Exception: MYMY --------- This appears to happen only when another Exception is in transit. If S is destructed normally at the end of the block rather than as part of exception winding (e.g., if the call to s.method() is commented out), the catch block works as expected. --