diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-28 12:23:24 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-28 12:23:24 +0000 |
commit | 0f46e64947bdd570a499732c4b459961627d8745 (patch) | |
tree | 3cab61f88d17f0b2df4dbedb3eb18b694d88cd12 /lib/Sema | |
parent | e8c0322701ce6ece0c24ab1391915676dd2eba1c (diff) |
Improve diagnostic wording for when an implicitly-deleted special member
function is selected by overload resolution.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171190 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 15 |
2 files changed, 6 insertions, 15 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 191a26d105..e573a15d6a 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -287,12 +287,6 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, /// diagnostic complaining about the given function being deleted or /// unavailable. std::string Sema::getDeletedOrUnavailableSuffix(const FunctionDecl *FD) { - // FIXME: C++0x implicitly-deleted special member functions could be - // detected here so that we could improve diagnostics to say, e.g., - // "base class 'A' had a deleted copy constructor". - if (FD->isDeleted()) - return std::string(); - std::string Message; if (FD->getAvailability(&Message)) return ": " + Message; diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index e5af2b16d7..7ae6d9d5af 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -10386,16 +10386,13 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, if (isImplicitlyDeleted(Best->Function)) { CXXMethodDecl *Method = cast<CXXMethodDecl>(Best->Function); Diag(OpLoc, diag::err_ovl_deleted_special_oper) - << getSpecialMember(Method) - << BinaryOperator::getOpcodeStr(Opc) - << getDeletedOrUnavailableSuffix(Best->Function); + << Context.getRecordType(Method->getParent()) + << getSpecialMember(Method); - if (getSpecialMember(Method) != CXXInvalid) { - // The user probably meant to call this special member. Just - // explain why it's deleted. - NoteDeletedFunction(Method); - return ExprError(); - } + // The user probably meant to call this special member. Just + // explain why it's deleted. + NoteDeletedFunction(Method); + return ExprError(); } else { Diag(OpLoc, diag::err_ovl_deleted_oper) << Best->Function->isDeleted() |