mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 15:40:55 +03:00
Fix wrong assertion wrt. virtual function vtbl index (#3327)
Fixes #3324 by checking the aggregate linkage, not the function's, for special vtbl index 0.
This commit is contained in:
parent
f28f4b3680
commit
40914dc23f
2 changed files with 11 additions and 2 deletions
|
@ -426,9 +426,10 @@ LLValue *DtoVirtualFunctionPointer(DValue *inst, FuncDeclaration *fdecl,
|
||||||
assert(fdecl->isVirtual());
|
assert(fdecl->isVirtual());
|
||||||
assert(!fdecl->isFinalFunc());
|
assert(!fdecl->isFinalFunc());
|
||||||
assert(inst->type->toBasetype()->ty == Tclass);
|
assert(inst->type->toBasetype()->ty == Tclass);
|
||||||
// 0 is always ClassInfo/Interface* unless it is a CPP interface
|
// slot 0 is always ClassInfo/Interface* unless it is a CPP class
|
||||||
assert(fdecl->vtblIndex > 0 ||
|
assert(fdecl->vtblIndex > 0 ||
|
||||||
(fdecl->vtblIndex == 0 && fdecl->linkage == LINKcpp));
|
(fdecl->vtblIndex == 0 &&
|
||||||
|
inst->type->toBasetype()->isTypeClass()->sym->isCPPclass()));
|
||||||
|
|
||||||
// get instance
|
// get instance
|
||||||
LLValue *vthis = DtoRVal(inst);
|
LLValue *vthis = DtoRVal(inst);
|
||||||
|
|
8
tests/compilable/gh3324.d
Normal file
8
tests/compilable/gh3324.d
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// RUN: %ldc -c %s
|
||||||
|
|
||||||
|
extern (C++) interface I
|
||||||
|
{
|
||||||
|
extern (System) void func();
|
||||||
|
}
|
||||||
|
|
||||||
|
void foo(I i) { i.func(); }
|
Loading…
Add table
Add a link
Reference in a new issue