Mercurial > projects > ldc
comparison gen/classes.cpp @ 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 | 4d7495038ae8 |
children | 051ab876fe11 |
comparison
equal
deleted
inserted
replaced
368:ca401c18c24e | 369:7d91d82000ae |
---|---|
825 // set the context for nested classes | 825 // set the context for nested classes |
826 else if (tc->sym->isNested()) | 826 else if (tc->sym->isNested()) |
827 { | 827 { |
828 Logger::println("Resolving nested context"); | 828 Logger::println("Resolving nested context"); |
829 LOG_SCOPE; | 829 LOG_SCOPE; |
830 | |
831 LLValue* gep = DtoGEPi(mem,0,2,"tmp"); | |
832 | |
830 // this value might be zero if it was not necessary to generate it ... | 833 // this value might be zero if it was not necessary to generate it ... |
831 LLValue* nest = gIR->func()->nestedVar; | 834 LLValue* nest = gIR->func()->nestedVar; |
832 // ... then revert to the this ptr if there is one | 835 // ... then revert to the this ptr if there is one |
833 if (!nest) | 836 if (!nest) |
834 nest = gIR->func()->thisVar; | 837 nest = gIR->func()->thisVar; |
835 // ... or just use zero, since it must be unused. | 838 // ... or just use zero, since it must be unused. |
836 if (!nest) | 839 if (!nest) |
837 nest = llvm::ConstantPointerNull::get(getVoidPtrType()); | 840 nest = llvm::Constant::getNullValue(gep->getType()->getContainedType(0)); |
838 assert(nest); | 841 else |
839 LLValue* gep = DtoGEPi(mem,0,2,"tmp"); | 842 nest = DtoBitCast(nest, gep->getType()->getContainedType(0)); |
840 nest = DtoBitCast(nest, gep->getType()->getContainedType(0)); | |
841 DtoStore(nest, gep); | 843 DtoStore(nest, gep); |
842 } | 844 } |
843 | 845 |
844 // call constructor | 846 // call constructor |
845 if (newexp->member) | 847 if (newexp->member) |