diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-05-05 00:13:13 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-05-05 00:13:13 +0000 |
commit | 439d3c3d76f858df5f25239f2a70f04312eacb5b (patch) | |
tree | 1f8b2662cfda43ac9a7a68d3ea0aa9f51233caf3 /lib | |
parent | 3dc05418538c719fea48b906bfa4febe5296e126 (diff) |
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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 3f3ed0e1f9..79caecc5a8 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/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) { |