]> granicus.if.org Git - clang/commitdiff
Fix a use of uninitialized memory in overload diagnostics.
authorJohn McCall <rjmccall@apple.com>
Sat, 16 Jan 2010 03:50:16 +0000 (03:50 +0000)
committerJohn McCall <rjmccall@apple.com>
Sat, 16 Jan 2010 03:50:16 +0000 (03:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93629 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp

index e4168eb7c8849bf1d476828f68e849fcb034c1e8..884192b73361485b70bef309b3c44c5743035742 100644 (file)
@@ -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;