From 9898a5e094c4c6a53f4a0368ffb8919ef4010af7 Mon Sep 17 00:00:00 2001
From: Christian Kamm <christian.d.kamm@nokia.com>
Date: Mon, 19 Sep 2011 13:48:28 +0200
Subject: [PATCH] C++: Fix bug in findMatchingDefinition.

In strict mode, don't give up after the first Document with candidates.

Change-Id: I62ba59708a3501b31f79d979b1a85bede875eccb
Reviewed-on: http://codereview.qt-project.org/5142
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
---
 src/libs/cplusplus/CppDocument.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp
index 7113e5db06a..0df7704e090 100644
--- a/src/libs/cplusplus/CppDocument.cpp
+++ b/src/libs/cplusplus/CppDocument.cpp
@@ -844,9 +844,11 @@ Symbol *Snapshot::findMatchingDefinition(Symbol *declaration, bool strict) const
                 }
             }
 
-            if (!strict && ! best)
-                best = viableFunctions.first();
+            if (strict && ! best)
+                continue;
 
+            if (! best)
+                best = viableFunctions.first();
             return best;
         }
     }
-- 
GitLab