diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-18 23:52:59 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-18 23:52:59 +0000 |
commit | e3898ac6cca333f9a781eb6df4be5f3ba8258559 (patch) | |
tree | 0d82af83bb192c21d20fdb66731a1e1079b6cf82 /lib/Sema/SemaOverload.cpp | |
parent | cdd1b371eab6bfca6a002fe7e16e3c77cb2f24b7 (diff) |
Fix OverloadCandidateSet::clear to not leak PartialDiagnostics, found by Samuel
Panzer. I've not been able to trigger a failure caused by this, so no test yet.
Also included is a small change from Paul Robinson to only consider the
FailureKind if the overload candidate did actually fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index f045a2b93c..9420b73d8b 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -735,9 +735,12 @@ OverloadCandidate::DeductionFailureInfo::getSecondArg() { } void OverloadCandidateSet::clear() { - for (iterator i = begin(), e = end(); i != e; ++i) + for (iterator i = begin(), e = end(); i != e; ++i) { for (unsigned ii = 0, ie = i->NumConversions; ii != ie; ++ii) i->Conversions[ii].~ImplicitConversionSequence(); + if (!i->Viable && i->FailureKind == ovl_fail_bad_deduction) + i->DeductionFailure.Destroy(); + } NumInlineSequences = 0; Candidates.clear(); Functions.clear(); |