diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index f0fee1fe6..e1969d715 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -3139,7 +3139,7 @@ bool Type::findDependency(const Type* ancestor) const if (this==ancestor) return true; for (std::vector::const_iterator parent=derivedFrom.begin(); parent!=derivedFrom.end(); ++parent) { - if (parent->type && parent->type->findDependency(ancestor)) + if (parent->type && (parent->type == this || parent->type->findDependency(ancestor))) return true; } return false; diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 1bfb50f3e..cdc7c0cbf 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -344,6 +344,7 @@ private: TEST_CASE(symboldatabase89); // valuetype name TEST_CASE(symboldatabase90); TEST_CASE(symboldatabase91); + TEST_CASE(symboldatabase92); // daca crash TEST_CASE(createSymbolDatabaseFindAllScopes1); @@ -4680,6 +4681,14 @@ private: ASSERT(functok->function()->name() == "foo"); } + void symboldatabase92() { // daca crash + GET_SYMBOL_DB("template struct a;\n" + "template \n" + "struct a : a<1, d...> {};\n" + "template struct f : a<0, e...> {};"); + ASSERT_EQUALS("", errout.str()); + } + void createSymbolDatabaseFindAllScopes1() { GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }"); ASSERT(db->scopeList.size() == 3);