From ed501b9bc3532f0128defa69805b0eb42d277fb7 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Tue, 1 Jun 2010 14:00:02 +0200
Subject: [PATCH] Look at the injected class name.

---
 src/libs/cplusplus/LookupContext.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 7e352db117d..21cecac3098 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -376,9 +376,18 @@ void ClassOrNamespace::lookup_helper(const Name *name, ClassOrNamespace *binding
     if (binding && ! processed->contains(binding)) {
         processed->insert(binding);
 
+        const Identifier *nameId = name->identifier();
+
         foreach (Symbol *s, binding->symbols()) {
-            if (ScopedSymbol *scoped = s->asScopedSymbol())
+            if (ScopedSymbol *scoped = s->asScopedSymbol()) {
+                if (Class *klass = scoped->asClass()) {
+                    if (const Identifier *id = klass->identifier()) {
+                        if (nameId && nameId->isEqualTo(id))
+                            result->append(klass);
+                    }
+                }
                 _factory->lookupInScope(name, scoped->members(), result, templateId);
+            }
         }
 
         foreach (Enum *e, binding->enums())
@@ -486,6 +495,13 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
         if (name->isNameId() || name->isTemplateNameId()) {
             flush();
 
+            foreach (Symbol *s, symbols()) {
+                if (Class *klass = s->asClass()) {
+                    if (klass->identifier() && klass->identifier()->isEqualTo(name->identifier()))
+                        return this;
+                }
+            }
+
             if (ClassOrNamespace *e = nestedType(name))
                 return e;
 
-- 
GitLab