aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-05 05:54:49 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-05 05:54:49 +0000
commit1de34dd8a6932fbb316e35304bf468ddb4a0841b (patch)
tree7ccf98629817435fc78b56fe52ea7e7857aece0b /lib/Sema/SemaDecl.cpp
parent1faa89f9c619e4b2411fab4af7e22ee7a2bd9009 (diff)
When the out-of-line definition differs from the declaration in the return type,
say "out-of-line definition differ from the declaration in the return type" instead of the silly "functions that differ only in their return type cannot be overloaded". Addresses rdar://7980179. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 9db6814466..aed950c8fc 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1201,7 +1201,11 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
&& OldReturnType->isObjCObjectPointerType())
ResQT = Context.mergeObjCGCQualifiers(NewQType, OldQType);
if (ResQT.isNull()) {
- Diag(New->getLocation(), diag::err_ovl_diff_return_type);
+ if (New->isCXXClassMember() && New->isOutOfLine())
+ Diag(New->getLocation(),
+ diag::err_member_def_does_not_match_ret_type) << New;
+ else
+ Diag(New->getLocation(), diag::err_ovl_diff_return_type);
Diag(Old->getLocation(), PrevDiag) << Old << Old->getType();
return true;
}