Fix #10260 debug: Executable scope 'x' with unknown function. (#3974)

* Fix #10174 debug: Executable scope 'x' with unknown function

* Format

* Add test for #10198

* Fix #10260 debug: Executable scope 'x' with unknown function.
This commit is contained in:
chrchr-github 2022-04-05 15:52:16 +02:00 committed by GitHub
parent 3ba6914563
commit c4dcfef385
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -2130,7 +2130,7 @@ namespace {
const ScopeInfo3 *scopeInfo = memberClassScope ? memberClassScope : currentScope;
// check in base types
if (scopeInfo->findTypeInBase(scope))
if (qualification.empty() && scopeInfo->findTypeInBase(scope))
return true;
// check using namespace

View File

@ -4919,6 +4919,29 @@ private:
ASSERT(function && function->token->str() == "A");
ASSERT(function->hasBody());
}
{
GET_SYMBOL_DB("namespace N {\n" // #10260
" namespace O {\n"
" struct B;\n"
" }\n"
"}\n"
"struct I {\n"
" using B = N::O::B;\n"
"};\n"
"struct A : I {\n"
" void f(B*);\n"
"};\n"
"void A::f(N::O::B*) {}\n");
ASSERT(db);
ASSERT_EQUALS(1, db->functionScopes.size());
auto it = std::find_if(db->scopeList.begin(), db->scopeList.end(), [](const Scope& s) {
return s.className == "A";
});
ASSERT(it != db->scopeList.end());
const Function* function = findFunctionByName("f", &*it);
ASSERT(function && function->token->str() == "f");
ASSERT(function->hasBody());
}
}
void createSymbolDatabaseFindAllScopes1() {