[Issue 14903] Destructors for arguments completely broken

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 11 12:06:00 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14903

--- Comment #6 from kinke at gmx.net ---
---
import core.stdc.stdio;

struct Struct {
    int a = 6;
    ~this() {
        printf("dtor\n");
        throw new Exception("big bang");
    }
}

int foo(bool doThrow) {
    printf("foo()\n");
    if (doThrow)
        throw new Exception("bla");
    return 1;
}

void main()
{
    bool doThrow = true;
    int r = Struct().a + foo(doThrow);
}
---

DMD 2.068.0, Win32:
foo()
dtor
dtor
dtor
...
crash

Works as expected if there's only a single throw (either in foo() or in dtor).

--


More information about the Digitalmars-d-bugs mailing list