Skip to content
Merged
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
28 changes: 28 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ class TestSymbolDatabase : public TestFixture {
TEST_CASE(symboldatabase110);
TEST_CASE(symboldatabase111); // [[fallthrough]]
TEST_CASE(symboldatabase112); // explicit operator
TEST_CASE(symboldatabase113);

TEST_CASE(createSymbolDatabaseFindAllScopes1);
TEST_CASE(createSymbolDatabaseFindAllScopes2);
Expand Down Expand Up @@ -5864,6 +5865,33 @@ class TestSymbolDatabase : public TestFixture {
ASSERT(f && f->function() && f->function()->isExplicit());
}

void symboldatabase113() { // #11841
GET_SYMBOL_DB("template <typename T>\n"
"struct S {\n"
" S();\n"
" int& g() { return a; }\n"
" struct I;\n"
"private:\n"
" int a;\n"
"};\n"
"template <>\n"
"struct S<int>::I{};\n");
ASSERT(db->scopeList.size() == 4);
auto it = db->scopeList.begin();
++it;
ASSERT_EQUALS_ENUM(ScopeType::eStruct, it->type);
ASSERT_EQUALS("I", it->className);
ASSERT_EQUALS(0, it->varlist.size());
++it;
ASSERT_EQUALS_ENUM(ScopeType::eStruct, it->type);
ASSERT_EQUALS("S < int >", it->className);
ASSERT_EQUALS(1, it->varlist.size());
++it;
ASSERT_EQUALS_ENUM(ScopeType::eFunction, it->type);
ASSERT_EQUALS("g", it->className);
ASSERT_EQUALS(0, it->varlist.size());
}

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