Bug?

RazvanN razvan.nitu1305 at gmail.com
Tue May 5 04:02:06 UTC 2020


truct K
{
     ~this() nothrow {}
}

void main()
{
     static class C
     {
         this(K, int) {}
     }

     static int foo(bool flag)
     {
         if (flag)
             throw new Exception("hello");
         return 1;
     }

     try
     {
         new C(K(), foo(true));
     }
     catch(Exception)
     {
     }
}

Result:

object.Exception at test.d(18): hello

If the destructor of K is not marked nothrow the code does not 
throw an exception. Is this a bug or am I missing something?


More information about the Digitalmars-d-learn mailing list