Fixed consturctors of structs that have invariant

This commit is contained in:
Alexey Prokhin
2011-01-06 15:08:07 +03:00
parent 34987f71e2
commit f57409958c
2 changed files with 12 additions and 0 deletions

View File

@@ -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);

View File

@@ -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);