Skip to content

Commit

Permalink
Merge pull request #892 from 9rnsr/fix7453
Browse files Browse the repository at this point in the history
Issue 7453 - Can't return value from within opApply
  • Loading branch information
WalterBright committed Apr 20, 2012
2 parents 79f502a + 4d28102 commit 03e8c26
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/statement.c
Expand Up @@ -3627,6 +3627,7 @@ ReturnStatement::ReturnStatement(Loc loc, Expression *exp)
: Statement(loc)
{
this->exp = exp;
this->implicit0 = 0;
}

Statement *ReturnStatement::syntaxCopy()
Expand All @@ -3644,7 +3645,6 @@ Statement *ReturnStatement::semantic(Scope *sc)

FuncDeclaration *fd = sc->parent->isFuncDeclaration();
Scope *scx = sc;
int implicit0 = 0;
Expression *eorg = NULL;

if (fd->fes)
Expand Down
1 change: 1 addition & 0 deletions src/statement.h
Expand Up @@ -604,6 +604,7 @@ struct SwitchErrorStatement : Statement
struct ReturnStatement : Statement
{
Expression *exp;
int implicit0;

ReturnStatement(Loc loc, Expression *exp);
Statement *syntaxCopy();
Expand Down
14 changes: 14 additions & 0 deletions test/runnable/test7453.d
@@ -0,0 +1,14 @@
struct S
{
int opApply(int delegate(string) dg)
{
return 0;
}
}
void main()
{
foreach (_; S())
{
return;
}
}

0 comments on commit 03e8c26

Please sign in to comment.