diff --git a/dmd2/expression.c b/dmd2/expression.c index 002fb280..67bf6e67 100644 --- a/dmd2/expression.c +++ b/dmd2/expression.c @@ -2795,6 +2795,9 @@ Expression *ThisExp::semantic(Scope *sc) #endif if (type && var) { //assert(global.errors || var); +#if IN_LLVM + var->isVarDeclaration()->checkNestedReference(sc, loc); +#endif return this; } diff --git a/dmd2/template.c b/dmd2/template.c index d48d432c..e6d2ebf9 100644 --- a/dmd2/template.c +++ b/dmd2/template.c @@ -4245,6 +4245,7 @@ void TemplateInstance::semanticTiargs(Loc loc, Scope *sc, Objects *tiargs, int f return; for (size_t j = 0; j < tiargs->dim; j++) { + Object *o = (Object *)tiargs->data[j]; Type *ta = isType(o); Expression *ea = isExpression(o); diff --git a/gen/toir.cpp b/gen/toir.cpp index 8dc0e1ef..50780a00 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -1324,7 +1324,8 @@ DValue* ThisExp::toElem(IRState* p) // regular this expr if (VarDeclaration* vd = var->isVarDeclaration()) { LLValue* v; - if (vd->toParent2() != p->func()->decl) { + Dsymbol* vdparent = vd->toParent2(); + if (vdparent != p->func()->decl) { Logger::println("nested this exp"); #if STRUCTTHISREF return DtoNestedVariable(loc, type, vd, type->ty == Tstruct);