Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,9 @@ void SymbolDatabase::createSymbolDatabaseSetTypePointers()
if (!tok->isName() || tok->varId() || tok->function() || tok->type() || tok->enumerator())
continue;

if (Token::simpleMatch(tok->next(), "<"))
continue;

if (typenames.find(tok->str()) == typenames.end())
continue;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
struct B{o a;B<>{0,{}}}
20 changes: 20 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ class TestSymbolDatabase : public TestFixture {
TEST_CASE(symboldatabase107);
TEST_CASE(symboldatabase108);
TEST_CASE(symboldatabase109); // #13553
TEST_CASE(symboldatabase110);

TEST_CASE(createSymbolDatabaseFindAllScopes1);
TEST_CASE(createSymbolDatabaseFindAllScopes2);
Expand Down Expand Up @@ -5760,6 +5761,25 @@ class TestSymbolDatabase : public TestFixture {
ASSERT(f && f->function() && f->function()->hasVirtualSpecifier());
}

void symboldatabase110() { // #13498
GET_SYMBOL_DB("struct A;\n"
"template <typename T, typename C>\n"
"struct B {\n"
" const A& a;\n"
" const std::vector<C>& c;\n"
"};\n"
"template <typename T>\n"
"struct B<T, void> {\n"
" const A& a;\n"
"};\n"
"template <typename T, typename C>\n"
"void f(const A & a, const std::vector<C>&c) {\n"
" B<T, C>{ a, c };\n"
"}\n");
const Token *B = db ? Token::findsimplematch(tokenizer.tokens(), "B < T , C >") : nullptr;
ASSERT(B && !B->type());
}

void createSymbolDatabaseFindAllScopes1() {
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
ASSERT(db->scopeList.size() == 3);
Expand Down
Loading