Skip to content

Commit

Permalink
fix Issue 7435 - Regression(master):dmd crashes when 'scope(failure) …
Browse files Browse the repository at this point in the history
…debug ...' without -debug option.
  • Loading branch information
WalterBright committed Feb 4, 2012
1 parent 30d0a2c commit 766bfba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,12 @@ Statement *CompoundStatement::semantic(Scope *sc)
statements->insert(i, sentry);
i++;
}
if (sexception)
sexception = sexception->semantic(sc);
if (sexception)
{
if (i + 1 == statements->dim && !sfinally)
{
sexception = sexception->semantic(sc);
}
else
{
Expand All @@ -546,7 +547,7 @@ Statement *CompoundStatement::semantic(Scope *sc)

Identifier *id = Lexer::uniqueId("__o");

Statement *handler = sexception->semantic(sc);
Statement *handler = sexception;
if (sexception->blockExit(FALSE) & BEfallthru)
{ handler = new ThrowStatement(0, new IdentifierExp(0, id));
handler = new CompoundStatement(0, sexception, handler);
Expand Down
10 changes: 10 additions & 0 deletions test/runnable/testscope.d
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ T readMessageEnd() {

/********************************************/

void test7435() {
scope(failure)
debug printf("error\n");

printf("do something\n");
}

/********************************************/

void main()
{
test1();
Expand All @@ -244,6 +253,7 @@ void main()
test8();
test9();
test10();
test7435();

printf("Success\n");
}

0 comments on commit 766bfba

Please sign in to comment.