Fix handling of constructor inherited through multiple levels of virtual base class.

llvm-svn: 285446
This commit is contained in:
Richard Smith 2016-10-28 20:20:58 +00:00
parent a9272314b9
commit a99fa39c41
2 changed files with 10 additions and 4 deletions

View File

@ -2957,11 +2957,10 @@ class ConstructorUsingShadowDecl final : public UsingShadowDecl {
dyn_cast<ConstructorUsingShadowDecl>(Target)),
ConstructedBaseClassShadowDecl(NominatedBaseClassShadowDecl),
IsVirtual(TargetInVirtualBase) {
// If we found a constructor for a non-virtual base class, but it chains to
// a constructor for a virtual base, we should directly call the virtual
// base constructor instead.
// If we found a constructor that chains to a constructor for a virtual
// base, we should directly call that virtual base constructor instead.
// FIXME: This logic belongs in Sema.
if (!TargetInVirtualBase && NominatedBaseClassShadowDecl &&
if (NominatedBaseClassShadowDecl &&
NominatedBaseClassShadowDecl->constructsVirtualBase()) {
ConstructedBaseClassShadowDecl =
NominatedBaseClassShadowDecl->ConstructedBaseClassShadowDecl;

View File

@ -87,6 +87,13 @@ namespace vbase {
D d2(0, 0); // expected-error {{deleted}}
}
namespace vbase_of_vbase {
struct V { V(int); };
struct W : virtual V { using V::V; };
struct X : virtual W, virtual V { using W::W; };
X x(0);
}
namespace constexpr_init_order {
struct Param;
struct A {