summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-05-12 00:28:35 +0000
committerBill Wendling <isanbard@gmail.com>2012-05-12 00:28:35 +0000
commite2f692bd189cfdf562175b786fe92c87ecdfcbfb (patch)
tree7e87711c6f0f484373ffa378964b34d7e0c8eb52 /lib/Sema/SemaDeclCXX.cpp
parent0b3707c66993e57868b5480e79a9e0707c987dc0 (diff)
Merging r155218:
------------------------------------------------------------------------ r155218 | rsmith | 2012-04-20 11:46:14 -0700 (Fri, 20 Apr 2012) | 5 lines Fix bug where a class's (deleted) copy constructor would be implicitly given a non-const reference parameter type if the class had any subobjects with deleted copy constructors. This causes a rejects-valid if the class's copy constructor is explicitly defaulted (as happens for some implementations of std::pair etc). ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@156682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index cec20af2d7..fe83985b42 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -7579,8 +7579,9 @@ Sema::ComputeDefaultedCopyAssignmentExceptionSpecAndConst(
assert(!Base->getType()->isDependentType() &&
"Cannot generate implicit members for class with dependent bases.");
CXXRecordDecl *BaseClassDecl = Base->getType()->getAsCXXRecordDecl();
- LookupCopyingAssignment(BaseClassDecl, Qualifiers::Const, false, 0,
- &HasConstCopyAssignment);
+ HasConstCopyAssignment &=
+ (bool)LookupCopyingAssignment(BaseClassDecl, Qualifiers::Const,
+ false, 0);
}
// In C++11, the above citation has "or virtual" added
@@ -7591,8 +7592,9 @@ Sema::ComputeDefaultedCopyAssignmentExceptionSpecAndConst(
assert(!Base->getType()->isDependentType() &&
"Cannot generate implicit members for class with dependent bases.");
CXXRecordDecl *BaseClassDecl = Base->getType()->getAsCXXRecordDecl();
- LookupCopyingAssignment(BaseClassDecl, Qualifiers::Const, false, 0,
- &HasConstCopyAssignment);
+ HasConstCopyAssignment &=
+ (bool)LookupCopyingAssignment(BaseClassDecl, Qualifiers::Const,
+ false, 0);
}
}
@@ -7606,8 +7608,9 @@ Sema::ComputeDefaultedCopyAssignmentExceptionSpecAndConst(
++Field) {
QualType FieldType = Context.getBaseElementType((*Field)->getType());
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
- LookupCopyingAssignment(FieldClassDecl, Qualifiers::Const, false, 0,
- &HasConstCopyAssignment);
+ HasConstCopyAssignment &=
+ (bool)LookupCopyingAssignment(FieldClassDecl, Qualifiers::Const,
+ false, 0);
}
}
@@ -8610,8 +8613,8 @@ Sema::ComputeDefaultedCopyCtorExceptionSpecAndConst(CXXRecordDecl *ClassDecl) {
CXXRecordDecl *BaseClassDecl
= cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
- LookupCopyingConstructor(BaseClassDecl, Qualifiers::Const,
- &HasConstCopyConstructor);
+ HasConstCopyConstructor &=
+ (bool)LookupCopyingConstructor(BaseClassDecl, Qualifiers::Const);
}
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->vbases_begin(),
@@ -8620,8 +8623,8 @@ Sema::ComputeDefaultedCopyCtorExceptionSpecAndConst(CXXRecordDecl *ClassDecl) {
++Base) {
CXXRecordDecl *BaseClassDecl
= cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
- LookupCopyingConstructor(BaseClassDecl, Qualifiers::Const,
- &HasConstCopyConstructor);
+ HasConstCopyConstructor &=
+ (bool)LookupCopyingConstructor(BaseClassDecl, Qualifiers::Const);
}
// -- for all the nonstatic data members of X that are of a
@@ -8634,8 +8637,8 @@ Sema::ComputeDefaultedCopyCtorExceptionSpecAndConst(CXXRecordDecl *ClassDecl) {
++Field) {
QualType FieldType = Context.getBaseElementType((*Field)->getType());
if (CXXRecordDecl *FieldClassDecl = FieldType->getAsCXXRecordDecl()) {
- LookupCopyingConstructor(FieldClassDecl, Qualifiers::Const,
- &HasConstCopyConstructor);
+ HasConstCopyConstructor &=
+ (bool)LookupCopyingConstructor(FieldClassDecl, Qualifiers::Const);
}
}
// Otherwise, the implicitly declared copy constructor will have