OSDN Git Service

Fix find-usages in template classes.
authorErik Verbruggen <erik.verbruggen@nokia.com>
Mon, 17 Jan 2011 12:39:41 +0000 (13:39 +0100)
committerErik Verbruggen <erik.verbruggen@nokia.com>
Mon, 17 Jan 2011 12:42:45 +0000 (13:42 +0100)
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

index 20e5cb4..38f168c 100644 (file)
@@ -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))