diff --git a/dmd2/func.c b/dmd2/func.c index 15295a3f..52555760 100644 --- a/dmd2/func.c +++ b/dmd2/func.c @@ -1615,9 +1615,17 @@ void FuncDeclaration::semantic3(Scope *sc) if (type->nextOf()->ty != Tvoid) { +#if IN_LLVM + Expression *e = 0; + if (isCtorDeclaration()) + e = new VarExp(0, vthis); + else + e = new VarExp(0, vresult); +#else // Create: return vresult; assert(vresult); Expression *e = new VarExp(0, vresult); +#endif if (tintro) { e = e->implicitCastTo(sc, tintro->nextOf()); e = e->semantic(sc); diff --git a/dmd2/statement.c b/dmd2/statement.c index f29202e2..f83b2b64 100644 --- a/dmd2/statement.c +++ b/dmd2/statement.c @@ -3645,7 +3645,11 @@ Statement *ReturnStatement::semantic(Scope *sc) if (exp) { +#if IN_LLVM + if (!fd->isCtorDeclaration() && fd->returnLabel && tbret->ty != Tvoid) +#else if (fd->returnLabel && tbret->ty != Tvoid) +#endif { assert(fd->vresult); VarExp *v = new VarExp(0, fd->vresult);