Skip to content

Commit

Permalink
Revert "fix Issue 14708 - destructor for temporary not called during …
Browse files Browse the repository at this point in the history
…stack unwinding"

This reverts commit e20c63c.

# Conflicts:
#	test/runnable/sdtor.d
  • Loading branch information
MartinNowak committed Sep 23, 2015
1 parent af4d3a4 commit 1a807d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 63 deletions.
14 changes: 2 additions & 12 deletions src/backend/cod2.c
Expand Up @@ -5079,14 +5079,9 @@ code *cddctor(elem *e,regm_t *pretregs)
*/
usednteh |= EHcleanup;
if (config.exe == EX_NT)
{
usednteh |= NTEHcleanup | NTEH_try;
{ usednteh |= NTEHcleanup | NTEH_try;
nteh_usevars();
}
else
{
usednteh |= EHtry;
}
assert(*pretregs == 0);
code cs;
cs.Iop = ESCAPE | ESCdctor;
Expand Down Expand Up @@ -5122,14 +5117,9 @@ code *cdddtor(elem *e,regm_t *pretregs)
*/
usednteh |= EHcleanup;
if (config.exe == EX_NT)
{
usednteh |= NTEHcleanup | NTEH_try;
{ usednteh |= NTEHcleanup | NTEH_try;
nteh_usevars();
}
else
{
usednteh |= EHtry;
}

code cs;
cs.Iop = ESCAPE | ESCddtor;
Expand Down
51 changes: 0 additions & 51 deletions test/runnable/sdtor.d
Expand Up @@ -4051,56 +4051,6 @@ void test14696(int len = 2)
check({ foo(len != 2 ? makeS(1).get(len != 2 ? makeS(2).get() : null) : null); }, "foo.");
}

/**********************************/
// 14708

bool dtor14708 = false;

struct S14708
{
int n;

void* get(void* p = null)
{
return null;
}

~this()
{
//printf("dtor\n");
dtor14708 = true;
}
}

S14708 makeS14708(int n)
{
return S14708(n);
}

void foo14708(void* x)
{
throw new Exception("fail!");
}

void bar14708()
{
foo14708(makeS14708(1).get());
// A temporary is allocated on stack for the
// return value from makeS(1).
// When foo throws exception, it's dtor should be called
// during unwinding stack, but it does not happen in Win64.
}

void test14708()
{
try
{
bar14708();
} catch (Exception e) {}
assert(dtor14708); // fails!
}

/**********************************/
// 14838

int test14838() pure nothrow @safe
Expand Down Expand Up @@ -4270,7 +4220,6 @@ int main()
test13095();
test14264();
test14696();
test14708();
test14838();

printf("Success\n");
Expand Down

0 comments on commit 1a807d1

Please sign in to comment.