C++: fix cloning of templates

Fix instantiation of templates(by cloning original symbols). Assigning of scope
for cloned symbol is taken from the symbol which is used to instantiate.

Task-number: QTCREATORBUG-9098
Change-Id: I066cc8b5f69333fabdaf2d4466b205baf08bd3f1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Przemyslaw Gorszkowski
2013-04-13 08:40:54 +02:00
committed by Nikolai Kosjar
parent b55961d225
commit 17cd161a9d
6 changed files with 88 additions and 1 deletions

View File

@@ -936,6 +936,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac
foreach (Symbol *s, reference->symbols()) {
Symbol *clone = cloner.symbol(s, &subst);
clone->setScope(s->scope());
instantiation->_symbols.append(clone);
#ifdef DEBUG_LOOKUP
Overview oo;oo.showFunctionSignatures = true;
@@ -1089,6 +1090,7 @@ void ClassOrNamespace::NestedClassInstantiator::instantiate(ClassOrNamespace *en
foreach (Symbol *s, nestedClassOrNamespace->_symbols) {
Symbol *clone = _cloner.symbol(s, &_subst);
clone->setScope(s->scope());
nestedClassOrNamespaceInstantiation->_symbols.append(clone);
}
}