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@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?
  • Bug? RazvanN via Digitalmars-d-learn
    • Re: Bug? Simen Kjærås via Digitalmars-d-learn
      • Re: Bug? RazvanN via Digitalmars-d-learn
    • Bug? Jack Applegame via Digitalmars-d-learn
      • Re: Bug? Jack Applegame via Digitalmars-d-learn
        • Re: Bug? Jack Applegame via Digitalmars-d-learn
      • Re: Bug? Adam D. Ruppe via Digitalmars-d-learn
        • Re: Bug? Jack Applegame via Digitalmars-d-learn
          • Re: Bug? Steven Schveighoffer via Digitalmars-d-learn
            • Re: Bug... Adam D. Ruppe via Digitalmars-d-learn
          • Re: Bug? Simen Kjærås via Digitalmars-d-learn

Reply via email to