Merged DMD commit c7f94c6b66d3b4233ea01dd3dd9f0028b7118870:

5349 ICE(toir.c): nested class in static member function

When checking if a nested class can reach a parent class, it should not be
possible to jump through static functions. Static member functions were just
being silently ignored, which meant nonsense was passed to the backend.
(Didn't always cause an ICE, sometimes generates nonsense code).
This commit is contained in:
David Nadlinger
2011-04-23 18:28:36 +02:00
parent 3cf9988681
commit d7eead617e

View File

@@ -128,6 +128,14 @@ Expression *getRightThis(Loc loc, Scope *sc, AggregateDeclaration *ad,
e1 = new VarExp(loc, f->vthis);
}
else
{
e1->error("need 'this' of type %s to access member %s"
" from static function %s",
ad->toChars(), var->toChars(), f->toChars());
e1 = new ErrorExp();
return e1;
}
}
if (s && s->isClassDeclaration())
{ e1->type = s->isClassDeclaration()->type;