Skip to content

Commit

Permalink
Merge branch 'master' of github.com:D-Programming-Language/dmd
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jan 6, 2012
2 parents 215d799 + 30cd9a7 commit 58c7689
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 33 deletions.
7 changes: 5 additions & 2 deletions src/statement.c
Expand Up @@ -546,8 +546,11 @@ Statement *CompoundStatement::semantic(Scope *sc)

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

Statement *handler = new ThrowStatement(0, new IdentifierExp(0, id));
handler = new CompoundStatement(0, sexception, handler);
Statement *handler = sexception->semantic(sc);
if (sexception->blockExit(FALSE) & BEfallthru)
{ handler = new ThrowStatement(0, new IdentifierExp(0, id));
handler = new CompoundStatement(0, sexception, handler);
}

Catches *catches = new Catches();
Catch *ctch = new Catch(0, NULL, id, handler);
Expand Down
95 changes: 64 additions & 31 deletions test/runnable/warning1.d
Expand Up @@ -3,20 +3,28 @@

extern(C) int printf(const char*, ...);

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

class F { }
int foo()
{
scope F f = new F(); // comment out and warning goes away
return 0;
}

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

int foo2()
{
try {
return 0;
} finally { }
try
{
return 0;
}
finally { }
}

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

private int getNthInt(A...)(uint index, A args)
{
foreach (i, arg; args)
Expand All @@ -37,42 +45,44 @@ private int getNthInt(A...)(uint index, A args)
/******************************************/

class Foo2 {
int foo() {
synchronized(this){
return 8;
}
}
int foo() {
synchronized(this){
return 8;
}
}
}

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

void main() {
int i=0;
printf("This number is zero: ");
goto inloop;
for(; i<10; i++) { // this is line 7
printf("This number is nonzero: ");
void mainX()
{
int i=0;
printf("This number is zero: ");
goto inloop;
for(; i<10; i++) { // this is line 7
printf("This number is nonzero: ");
inloop:
printf("%d\n", i);
}
printf("%d\n", i);
}
}

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

string foo3(int bar)
{
switch (bar) {
case 1:
return "1";
case 2:
return "2";
default:
return "3";
}
switch (bar)
{
case 1:
return "1";
case 2:
return "2";
default:
return "3";
}
}


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

int foo4()
{
Expand All @@ -83,7 +93,7 @@ int foo4()
}
}

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

int foo5()
{
Expand All @@ -93,16 +103,24 @@ int foo5()
} while (true);
}

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

nothrow int foo6()
{
int x= 2;
try { } catch(Exception e) { x=4; throw new Exception("xxx"); }
int x = 2;
try
{
}
catch(Exception e)
{
x = 4;
throw new Exception("xxx");
}
return x;
}

/*****************************************/
/******************************************/
// 6518

template TypeTuple(T...) { alias T TypeTuple; }
void test6518()
Expand All @@ -114,3 +132,18 @@ void test6518()
default: assert(0);
}
}

/******************************************/
// 7232

bool test7232()
{
scope(failure) return false;
return true;
}

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

void main()
{
}

0 comments on commit 58c7689

Please sign in to comment.