Mercurial > projects > ldc
changeset 369:7d91d82000ae trunk
[svn r390] Make the zero value used when no nested context was created of the correct type.
Fixes run/class_06.
author | ChristianK |
---|---|
date | Tue, 15 Jul 2008 08:44:08 +0200 |
parents | ca401c18c24e |
children | 051ab876fe11 |
files | gen/classes.cpp |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/classes.cpp Tue Jul 15 08:20:21 2008 +0200 +++ b/gen/classes.cpp Tue Jul 15 08:44:08 2008 +0200 @@ -827,6 +827,9 @@ { Logger::println("Resolving nested context"); LOG_SCOPE; + + LLValue* gep = DtoGEPi(mem,0,2,"tmp"); + // this value might be zero if it was not necessary to generate it ... LLValue* nest = gIR->func()->nestedVar; // ... then revert to the this ptr if there is one @@ -834,10 +837,9 @@ nest = gIR->func()->thisVar; // ... or just use zero, since it must be unused. if (!nest) - nest = llvm::ConstantPointerNull::get(getVoidPtrType()); - assert(nest); - LLValue* gep = DtoGEPi(mem,0,2,"tmp"); - nest = DtoBitCast(nest, gep->getType()->getContainedType(0)); + nest = llvm::Constant::getNullValue(gep->getType()->getContainedType(0)); + else + nest = DtoBitCast(nest, gep->getType()->getContainedType(0)); DtoStore(nest, gep); }