Fix #10259 debug: SymbolDatabase couldn't resolve all user defined types (#4879)

This commit is contained in:
chrchr-github 2023-03-10 19:04:46 +01:00 committed by GitHub
parent 8148095fe5
commit 7881b99547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -891,6 +891,8 @@ void SymbolDatabase::createSymbolDatabaseNeedInitialization()
for (Scope& scope : scopeList) {
if (!scope.isClassOrStructOrUnion())
continue;
if (scope.classDef && Token::simpleMatch(scope.classDef->previous(), ">")) // skip uninstantiated template
continue;
if (!scope.definedType) {
mBlankTypes.emplace_back();

View File

@ -267,6 +267,7 @@ private:
TEST_CASE(namespaces2);
TEST_CASE(namespaces3); // #3854 - unknown macro
TEST_CASE(namespaces4);
TEST_CASE(needInitialization);
TEST_CASE(tryCatch1);
@ -2790,6 +2791,20 @@ private:
ASSERT_EQUALS(2U, fredAType->classDef->linenr());
}
void needInitialization() { // #10259
const auto oldSettings = settings1;
settings1.debugwarnings = true;
GET_SYMBOL_DB("template <typename T>\n"
"struct A {\n"
" using type = T;\n"
" type t_;\n"
"};\n");
ASSERT_EQUALS("", errout.str());
settings1 = oldSettings;
}
void tryCatch1() {
const char str[] = "void foo() {\n"
" try { }\n"