From: John McCall Date: Sat, 16 Jan 2010 03:50:16 +0000 (+0000) Subject: Fix a use of uninitialized memory in overload diagnostics. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3cf22b3b4535282998d74826ccff970a140258f;p=clang Fix a use of uninitialized memory in overload diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93629 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index e4168eb7c8..884192b733 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -4585,7 +4585,7 @@ void NoteAmbiguousUserConversions(Sema &S, SourceLocation OpLoc, SourceLocation GetLocationForCandidate(const OverloadCandidate *Cand) { if (Cand->Function) return Cand->Function->getLocation(); - if (Cand->Surrogate) + if (Cand->IsSurrogate) return Cand->Surrogate->getLocation(); return SourceLocation(); } @@ -4596,6 +4596,9 @@ struct CompareOverloadCandidatesForDisplay { bool operator()(const OverloadCandidate *L, const OverloadCandidate *R) { + // Fast-path this check. + if (L == R) return false; + // Order first by viability. if (L->Viable) { if (!R->Viable) return true;