Add implicitly-declared default and copy constructors to C++ classes,
when appropriate.
Conversions for class types now make use of copy constructors. I've
replaced the egregious hack allowing class-to-class conversions with a
slightly less egregious hack calling these conversions standard
conversions (for overloading reasons).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58622 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index fb47904..fa4f35b 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -59,6 +59,18 @@
this->Bases[i] = *Bases[i];
}
+bool CXXRecordDecl::hasConstCopyConstructor(ASTContext &Context) const {
+ for (OverloadedFunctionDecl::function_const_iterator Con
+ = Constructors.function_begin();
+ Con != Constructors.function_end(); ++Con) {
+ unsigned TypeQuals;
+ if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context, TypeQuals) &&
+ (TypeQuals & QualType::Const != 0))
+ return true;
+ }
+ return false;
+}
+
void
CXXRecordDecl::addConstructor(ASTContext &Context,
CXXConstructorDecl *ConDecl) {