Skip to content

Commit

Permalink
Merge pull request #2222 from 9rnsr/fixup10405
Browse files Browse the repository at this point in the history
fixup pull#2210 - Change error report timing
  • Loading branch information
9rnsr committed Jun 19, 2013
2 parents 3527e7d + 58f0c95 commit 03bc9f2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/statement.c
Expand Up @@ -3906,6 +3906,11 @@ Statement *ReturnStatement::semantic(Scope *sc)

if (exp && tbret->ty == Tvoid && !implicit0)
{
if (exp->type->ty != Tvoid)
{
error("cannot return non-void from void function");
}

/* Replace:
* return exp;
* with:
Expand All @@ -3915,11 +3920,6 @@ Statement *ReturnStatement::semantic(Scope *sc)
Statement *s = new ExpStatement(loc, ce);
s = s->semantic(sc);

if (exp->type->ty != Tvoid)
{
error("cannot return non-void from void function");
}

exp = NULL;
return new CompoundStatement(loc, s, this);
}
Expand Down

0 comments on commit 03bc9f2

Please sign in to comment.