Commit e53f4352 authored by Przemyslaw Gorszkowski's avatar Przemyslaw Gorszkowski Committed by Erik Verbruggen
Browse files

Fix crashes when cyclic inheritance

More complex situation.
Base class is a template and derived class is a template.

Task-number: QTCREATORBUG-8072
Task-number: QTCREATORBUG-7962
Change-Id: I7e8aa727fccd2bd4a779e6fe781553cd12196682
Reviewed-by: default avatarErik Verbruggen <>
parent 40a6f0b1
......@@ -58,7 +58,15 @@ public:
bool contains(const T *item)
return _container.contains(item);
if (_container.contains(item))
return true;
foreach (const T *existingItem, _container) {
if (existingItem->isEqualTo(item))
return true;
return false;
void clear(const T *item)
......@@ -930,4 +930,43 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data()
QTest::newRow("case: indirect cyclic inheritance with templates")
<< code << completions;
code = "\n"
"namespace NS\n"
"template <typename T> struct SuperClass\n"
" typedef T Type;\n"
" Type super_class_type;\n"
"template <typename T>\n"
"struct Class;\n"
"template <typename T, typename S>\n"
"struct ClassRecurse : Class<S>\n"
" T class_recurse_t;\n"
" S class_recurse_s;\n"
"template <typename T>\n"
"struct Class : ClassRecurse< T, typename ::NS::SuperClass<T>::Type >\n"
" T class_t;\n"
"Class<int> c;\n"
QTest::newRow("case: direct cyclic inheritance with templates, more complex situation")
<< code << completions;
Supports Markdown
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