From 982adb518c34bb8a00d27cf7e42806b57113af9f Mon Sep 17 00:00:00 2001 From: John McCall Date: Sat, 16 Jan 2010 03:50:16 +0000 Subject: Fix a use of uninitialized memory in overload diagnostics. llvm-svn: 93629 --- clang/lib/Sema/SemaOverload.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema') diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index e4168eb7c88..884192b7336 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/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; -- cgit v1.2.3