From 3cc856932263baf95d658a9e0587950a013fdba3 Mon Sep 17 00:00:00 2001 From: Robert Clipsham Date: Thu, 23 Dec 2010 22:06:55 +0000 Subject: [PATCH] Fixed ldc bug #444: Segfault when calling non-static methods from static methods. --- gen/toir.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/gen/toir.cpp b/gen/toir.cpp index 519e2aab..ada97c7a 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -88,7 +88,14 @@ DValue* VarExp::toElem(IRState* p) cachedLvalue = NULL; return new DVarValue(type, V); } - + + // this is an error! must be accessed with DotVarExp + if (var->needThis()) + { + error("need 'this' to access member %s", toChars()); + fatal(); + } + if (VarDeclaration* vd = var->isVarDeclaration()) { Logger::println("VarDeclaration ' %s ' of type ' %s '", vd->toChars(), vd->type->toChars()); @@ -100,14 +107,6 @@ DValue* VarExp::toElem(IRState* p) return new DConstValue(type, DtoConstBool(false)); } #endif - - // this is an error! must be accessed with DotVarExp - if (var->needThis()) - { - error("need 'this' to access member %s", toChars()); - fatal(); - } - // _arguments if (vd->ident == Id::_arguments && p->func()->_arguments) {