From daafa533d6e9d2efbbfdbf97d44ee8edabbaa957 Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@nokia.com>
Date: Mon, 17 Jan 2011 13:39:41 +0100
Subject: [PATCH] Fix find-usages in template classes.

The problem was that the scope of the class declaration in a template-class
declaration is the template, not the scope in which that template is defined.
The scope-check was not taking this into account.

Task-number: QTCREATORBUG-3183
Reviewed-by: Roberto Raggi
---
 src/libs/cplusplus/FindUsages.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp
index 20e5cb4418d..38f168cebd1 100644
--- a/src/libs/cplusplus/FindUsages.cpp
+++ b/src/libs/cplusplus/FindUsages.cpp
@@ -229,8 +229,12 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
             }
 
             if (isLocalScope(_declSymbol->enclosingScope()) || isLocalScope(s->enclosingScope())) {
-                if (s->enclosingScope() != _declSymbol->enclosingScope())
+                if (s->enclosingScope()->isTemplate()) {
+                    if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope())
+                        return false;
+                } else if (s->enclosingScope() != _declSymbol->enclosingScope()) {
                     return false;
+                }
             }
 
             if (compareFullyQualifiedName(LookupContext::fullyQualifiedName(s), _declSymbolFullyQualifiedName))
-- 
GitLab