Commit 5d76b433 authored by Przemyslaw Gorszkowski's avatar Przemyslaw Gorszkowski
Browse files

C++: nested class with enclosing template class



The parent of instantiation of nested class of template class
should be the instantiation of enclosing template class.

Task-number: QTCREATORBUG-11752
Change-Id: I8875c738848b85731f5ea88a60da190b4b0ad18f
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent df5d9f99
......@@ -1268,6 +1268,7 @@ void ClassOrNamespace::NestedClassInstantiator::instantiate(ClassOrNamespace *en
}
}
nestedClassOrNamespaceInstantiation->_parent = enclosingTemplateClassInstantiation;
instantiate(nestedClassOrNamespace, nestedClassOrNamespaceInstantiation);
enclosingTemplateClassInstantiation->_classOrNamespaces[nestedName] =
......
......@@ -2233,6 +2233,22 @@ void CppToolsPlugin::test_completion_data()
" double val = @\n"
"}\n"
) << _("d.constBegin()->") << (QStringList());
QTest::newRow("nested_class_in_template_class_QTCREATORBUG-11752") << _(
"template <typename T>\n"
"struct Temp\n"
"{\n"
" struct Nested1 { T t; };\n"
" struct Nested2 { Nested1 n1; };\n"
"};\n"
"struct Foo { int foo; };\n"
"void fun() {\n"
" Temp<Foo>::Nested2 n2;\n"
" @\n"
"}\n"
) << _("n2.n1.t.") << (QStringList()
<< QLatin1String("foo")
<< QLatin1String("Foo"));
}
void CppToolsPlugin::test_completion_member_access_operator()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment