Skip to content

Commit

Permalink
merge D2 pull #846
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Mar 30, 2012
1 parent c6866d4 commit 82227e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/interpret.c
Expand Up @@ -724,6 +724,11 @@ Expression *FuncDeclaration::interpret(InterState *istate, Expressions *argument
// If fell off the end of a void function, return void
if (!e && type->toBasetype()->nextOf()->ty == Tvoid)
return EXP_VOID_INTERPRET;

// If result is void, return void
if (e == EXP_VOID_INTERPRET)
return e;

// If it generated an exception, return it
if (exceptionOrCantInterpret(e))
{
Expand All @@ -732,6 +737,9 @@ Expression *FuncDeclaration::interpret(InterState *istate, Expressions *argument
((ThrownExceptionExp *)e)->generateUncaughtError();
return EXP_CANT_INTERPRET;
}

// If we're about to leave CTFE, make sure we don't crash the
// compiler by returning a CTFE-internal expression.
if (!istate && !evaluatingArgs)
{
e = scrubReturnValue(loc, e);
Expand Down

0 comments on commit 82227e4

Please sign in to comment.