Revert change to treat bodyless functions in abstract classes as abstract.

See DMD bug 2894.
This commit is contained in:
Christian Kamm 2009-04-25 09:11:32 +02:00
parent 83dda319ae
commit 8916f783b7
2 changed files with 4 additions and 7 deletions

View file

@ -386,11 +386,8 @@ void DtoResolveFunction(FuncDeclaration* fdecl)
Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars()); Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars());
LOG_SCOPE; LOG_SCOPE;
// queue declaration unless the function is abstract without body; // queue declaration unless the function is abstract without body
// bodyless functions in an abstract class are considered abstract if (!fdecl->isAbstract() || fdecl->fbody)
ClassDeclaration* cd = fdecl->isMember() ? fdecl->isMember()->isClassDeclaration() : NULL;
bool isabstract = fdecl->isAbstract() || (cd && cd->isAbstract());
if (!isabstract || fdecl->fbody)
{ {
DtoDeclareFunction(fdecl); DtoDeclareFunction(fdecl);
} }

View file

@ -132,7 +132,7 @@ LLConstant * IrStruct::getVtblInit()
FuncDeclaration* fd = dsym->isFuncDeclaration(); FuncDeclaration* fd = dsym->isFuncDeclaration();
assert(fd && "vtbl entry not a function"); assert(fd && "vtbl entry not a function");
if ((cd->isAbstract() || fd->isAbstract()) && !fd->fbody) if (fd->isAbstract() && !fd->fbody)
{ {
c = getNullValue(DtoType(fd->type->pointerTo())); c = getNullValue(DtoType(fd->type->pointerTo()));
} }
@ -335,7 +335,7 @@ llvm::GlobalVariable * IrStruct::getInterfaceVtbl(BaseClass * b, bool new_instan
FuncDeclaration* fd = dsym->isFuncDeclaration(); FuncDeclaration* fd = dsym->isFuncDeclaration();
assert(fd && "vtbl entry not a function"); assert(fd && "vtbl entry not a function");
assert(!((fd->isAbstract() || cd->isAbstract()) && !fd->fbody) && assert((!fd->isAbstract() || fd->fbody) &&
"null symbol in interface implementation vtable"); "null symbol in interface implementation vtable");
fd->codegen(Type::sir); fd->codegen(Type::sir);