diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-01-13 22:57:31 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-01-13 22:57:31 +0000 |
commit | 018e6eada09679904f6aeeb43c230194b4f542bd (patch) | |
tree | 13209ffec44c77d04616b92880e2b64fcd98d3c5 /test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp | |
parent | d18d1517f601ae5b2249ca1bd4e6db906cf3985e (diff) |
[ms-abi] Always generate complete constructors in the Microsoft C++ ABI
Fixes PR18435, where we generated a base ctor instead of a complete
ctor, and so failed to construct virtual bases when constructing the
complete object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp')
-rw-r--r-- | test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp b/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp index 7c223ca0a7..1014ae402f 100644 --- a/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp +++ b/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp @@ -312,3 +312,30 @@ D::~D() { } } + +namespace test2 { +struct A { A(); }; +struct B : virtual A { B() {} }; +struct C : B, A { C() {} }; + +// PR18435: Order mattered here. We were generating code for the delegating +// call to B() from C(). +void callC() { C x; } + +// CHECK-LABEL: define linkonce_odr x86_thiscallcc %"struct.test2::C"* @"\01??0C@test2@@QAE@XZ" +// CHECK: (%"struct.test2::C"* returned %this, i32 %is_most_derived) +// CHECK: br i1 +// Virtual bases +// CHECK: call x86_thiscallcc %"struct.test2::A"* @"\01??0A@test2@@QAE@XZ"(%"struct.test2::A"* %{{.*}}) +// CHECK: br label +// Non-virtual bases +// CHECK: call x86_thiscallcc %"struct.test2::B"* @"\01??0B@test2@@QAE@XZ"(%"struct.test2::B"* %{{.*}}, i32 0) +// CHECK: call x86_thiscallcc %"struct.test2::A"* @"\01??0A@test2@@QAE@XZ"(%"struct.test2::A"* %{{.*}}) +// CHECK: ret + +// CHECK2-LABEL: define linkonce_odr x86_thiscallcc %"struct.test2::B"* @"\01??0B@test2@@QAE@XZ" +// CHECK2: (%"struct.test2::B"* returned %this, i32 %is_most_derived) +// CHECK2: call x86_thiscallcc %"struct.test2::A"* @"\01??0A@test2@@QAE@XZ"(%"struct.test2::A"* %{{.*}}) +// CHECK2: ret + +} |