Author: rsmith Date: Wed Aug 31 15:37:39 2016 New Revision: 280288 URL: http://llvm.org/viewvc/llvm-project?rev=280288&view=rev Log: Fix mishandling of deletedness for assignment operators of classes with indirect virtual bases. We don't need to be able to invoke such an assignment operator from the derived class, and we shouldn't delete the derived assignment op if we can't do so.
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/test/CXX/special/class.copy/p20.cpp Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=280288&r1=280287&r2=280288&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Aug 31 15:37:39 2016 @@ -6765,13 +6765,14 @@ bool Sema::ShouldDeleteSpecialMember(CXX 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; Modified: cfe/trunk/test/CXX/special/class.copy/p20.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.copy/p20.cpp?rev=280288&r1=280287&r2=280288&view=diff ============================================================================== --- cfe/trunk/test/CXX/special/class.copy/p20.cpp (original) +++ cfe/trunk/test/CXX/special/class.copy/p20.cpp Wed Aug 31 15:37:39 2016 @@ -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(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits