Fix check if nested function can access outer function frame

The previous check wouldn't check intermediate aggregates for static-ness,
that was one problem. The other was the assertion that the outer function
can be reached as long as there are no static functions inbetween, which
isn't always the case, as issue #1864 clearly shows, which is resolved by
this.
This commit is contained in:
Martin 2016-11-18 00:00:37 +01:00
parent 734398a225
commit 0de021fe32
5 changed files with 31 additions and 37 deletions

View file

@ -852,7 +852,7 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
// data from the template function itself, but it would still mess up our
// nested context creation code.
FuncDeclaration *parent = fd;
while ((parent = getParentFunc(parent, true))) {
while ((parent = getParentFunc(parent))) {
if (parent->semanticRun != PASSsemantic3done || parent->semantic3Errors) {
IF_LOG Logger::println(
"Ignoring nested function with unanalyzed parent.");