diff --git a/lib/AST/DeclarationName.cpp b/lib/AST/DeclarationName.cpp index 044acd71d4..ae579c26fa 100644 --- a/lib/AST/DeclarationName.cpp +++ b/lib/AST/DeclarationName.cpp @@ -286,9 +286,11 @@ DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind, switch (Kind) { case DeclarationName::CXXConstructorName: EKind = DeclarationNameExtra::CXXConstructor; + assert(Ty.getCVRQualifiers() == 0 && "Constructor type must be unqualified"); break; case DeclarationName::CXXDestructorName: EKind = DeclarationNameExtra::CXXDestructor; + assert(Ty.getCVRQualifiers() == 0 && "Destructor type must be unqualified"); break; case DeclarationName::CXXConversionFunctionName: EKind = DeclarationNameExtra::CXXConversionFunction; diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 26ef1bdaa3..7ef7d85426 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1115,7 +1115,7 @@ bool Sema::IsUserDefinedConversion(Expr *From, QualType ToType, CXXRecordDecl *ToRecordDecl = ToRecordType->getDecl(); DeclarationName ConstructorName = Context.DeclarationNames.getCXXConstructorName( - Context.getCanonicalType(ToType)); + Context.getCanonicalType(ToType).getUnqualifiedType()); DeclContext::lookup_iterator Con, ConEnd; for (llvm::tie(Con, ConEnd) = ToRecordDecl->lookup(ConstructorName); Con != ConEnd; ++Con) { diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index bc473834bf..d8be6bca49 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -172,3 +172,14 @@ void test_arrow(Arrow1 a1, Arrow2 a2, const Arrow2 a3) { int &i2 = a2->m; a3->m; // expected-error{{no viable overloaded 'operator->'; candidate is}} } + +struct CopyConBase { +}; + +struct CopyCon : public CopyConBase { + CopyCon(const CopyConBase &Base); + + CopyCon(const CopyConBase *Base) { + *this = *Base; + } +};