зеркало из https://github.com/microsoft/clang.git
Fix another vbase layout bug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100952 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
a1e87162d3
Коммит
573021fc10
|
@ -263,8 +263,12 @@ ASTRecordLayoutBuilder::LayoutVirtualBases(const CXXRecordDecl *RD,
|
|||
uint64_t BaseOffset;
|
||||
|
||||
if (I->isVirtual()) {
|
||||
// If we don't know this vbase yet, don't visit it. It will be visited
|
||||
// later.
|
||||
if (!VBases.count(Base))
|
||||
continue;
|
||||
|
||||
// We want the vbase offset from the class we're currently laying out.
|
||||
assert(VBases.count(Base) && "Did not find virtual base!");
|
||||
BaseOffset = VBases[Base];
|
||||
} else if (RD == MostDerivedClass) {
|
||||
// We want the base offset from the class we're currently laying out.
|
||||
|
|
|
@ -1364,3 +1364,26 @@ struct D : virtual C {
|
|||
void D::f() { }
|
||||
|
||||
}
|
||||
|
||||
namespace Test32 {
|
||||
|
||||
// Check that we correctly lay out the virtual bases of 'Test32::D'.
|
||||
|
||||
struct A {
|
||||
virtual void f();
|
||||
};
|
||||
|
||||
struct B : virtual A { };
|
||||
struct C : A, virtual B { };
|
||||
struct D : virtual B { };
|
||||
|
||||
// CHECK: Virtual base offset offsets for 'Test32::E' (3 entries).
|
||||
// CHECK-NEXT: Test32::A | -32
|
||||
// CHECK-NEXT: Test32::B | -24
|
||||
// CHECK-NEXT: Test32::D | -40
|
||||
struct E : C, virtual D {
|
||||
virtual void f();
|
||||
};
|
||||
void E::f() { }
|
||||
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче