summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-05-05 00:13:13 +0000
committerDouglas Gregor <dgregor@apple.com>2011-05-05 00:13:13 +0000
commit1d33f8d8a0d7e4a7ef47562a754b0791f7a211d4 (patch)
tree9acf17ccd4313b8a9c0db2c8b4b0411bea807ad3 /clang/lib/Sema/SemaOverload.cpp
parent85c011ddc49cb2b108baaca6b36b76b9dcfd7119 (diff)
downloadbcm5719-llvm-1d33f8d8a0d7e4a7ef47562a754b0791f7a211d4.tar.gz
bcm5719-llvm-1d33f8d8a0d7e4a7ef47562a754b0791f7a211d4.zip
With invalid overloaded operators, we can get into funny cases where
the overloading of member and non-member functions results in arity mismatches that don't fit well into our overload-printing scheme. This only happens for invalid code (which breaks the arity invariants for these cases), so just suppress the diagnostic rather than inventing anything new. Fixes <rdar://problem/9222009>. llvm-svn: 130902
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 3f3ed0e1f90..79caecc5a83 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -6676,6 +6676,15 @@ void DiagnoseArityMismatch(Sema &S, OverloadCandidate *Cand,
unsigned MinParams = Fn->getMinRequiredArguments();
+ // With invalid overloaded operators, it's possible that we think we
+ // have an arity mismatch when it fact it looks like we have the
+ // right number of arguments, because only overloaded operators have
+ // the weird behavior of overloading member and non-member functions.
+ // Just don't report anything.
+ if (Fn->isInvalidDecl() &&
+ Fn->getDeclName().getNameKind() == DeclarationName::CXXOperatorName)
+ return;
+
// at least / at most / exactly
unsigned mode, modeCount;
if (NumFormalArgs < MinParams) {
OpenPOWER on IntegriCloud