Here's a reduced example that does not depend on std.exception:
-------
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
Looks like a bug in druntime, or a codegen bug?
T
--
Help a man when he is in trouble and he will remember you when he is in trouble
again.