r285446 - Fix handling of constructor inherited through multiple levels of virtual base class.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 28 13:20:58 PDT 2016
Author: rsmith
Date: Fri Oct 28 15:20:58 2016
New Revision: 285446
URL: http://llvm.org/viewvc/llvm-project?rev=285446&view=rev
Log:
Fix handling of constructor inherited through multiple levels of virtual base class.
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=285446&r1=285445&r2=285446&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Oct 28 15:20:58 2016
@@ -2957,11 +2957,10 @@ class ConstructorUsingShadowDecl final :
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;
Modified: cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp?rev=285446&r1=285445&r2=285446&view=diff
==============================================================================
--- cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp (original)
+++ cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp Fri Oct 28 15:20:58 2016
@@ -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 {
More information about the cfe-commits
mailing list