summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp7
-rw-r--r--clang/test/CXX/special/class.copy/p20.cpp3
2 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 585cd04d064..eb8c3d2cc83 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -6765,13 +6765,14 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
SpecialMemberDeletionInfo SMI(*this, MD, CSM, ICI, Diagnose);
for (auto &BI : RD->bases())
- if (!BI.isVirtual() &&
+ if ((SMI.IsAssignment || !BI.isVirtual()) &&
SMI.shouldDeleteForBase(&BI))
return true;
// Per DR1611, do not consider virtual bases of constructors of abstract
- // classes, since we are not going to construct them.
- if (!RD->isAbstract() || !SMI.IsConstructor) {
+ // classes, since we are not going to construct them. For assignment
+ // operators, we only assign (and thus only consider) direct bases.
+ if ((!RD->isAbstract() || !SMI.IsConstructor) && !SMI.IsAssignment) {
for (auto &BI : RD->vbases())
if (SMI.shouldDeleteForBase(&BI))
return true;
diff --git a/clang/test/CXX/special/class.copy/p20.cpp b/clang/test/CXX/special/class.copy/p20.cpp
index 8dfb7ca8a06..4f17879ecfb 100644
--- a/clang/test/CXX/special/class.copy/p20.cpp
+++ b/clang/test/CXX/special/class.copy/p20.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct ConstCopy {
ConstCopy();
OpenPOWER on IntegriCloud