From 2f58fb95bc3f145e5cc5660a21b7103215d308cc Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Tue, 22 Nov 2011 10:51:54 +0100 Subject: [PATCH] C++: Fix completion for namespace aliases at global or namespace scope. Task-number: QTCREATORBUG-166 Change-Id: Ic0fe4067caad37e51f7e253fd6678a6680350870 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> --- src/libs/cplusplus/LookupContext.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 4908b1c65e3..b6a9d62a6dc 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -518,6 +518,14 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope, item.setDeclaration(s); item.setBinding(binding); + if (s->asNamespaceAlias() && binding) { + ClassOrNamespace *targetNamespaceBinding = binding->lookupType(name); + if (targetNamespaceBinding && targetNamespaceBinding->symbols().size() == 1) { + Symbol *resolvedSymbol = targetNamespaceBinding->symbols().first(); + item.setType(resolvedSymbol->type()); // override the type + } + } + if (templateId && (s->isDeclaration() || s->isFunction())) { FullySpecifiedType ty = DeprecatedGenTemplateInstance::instantiate(templateId, s, _control); item.setType(ty); // override the type. -- GitLab