Skip to content

Commit

Permalink
Don't set type for simplified using declarations (f'up to #8454) (#6088)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Mar 8, 2024
1 parent 7e42652 commit 43e4fac
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
}

// using type alias
else if (mTokenizer.isCPP() && tok->isKeyword() && Token::Match(tok, "using %name% =")) {
else if (mTokenizer.isCPP() && tok->isKeyword() && Token::Match(tok, "using %name% =") && !tok->tokAt(2)->isSimplifiedTypedef()) {
if (tok->strAt(-1) != ">" && !findType(tok->next(), scope)) {
// fill typeList..
typeList.emplace_back(tok, nullptr, scope);
Expand Down
19 changes: 19 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ class TestSymbolDatabase : public TestFixture {
TEST_CASE(symboldatabase102);
TEST_CASE(symboldatabase103);
TEST_CASE(symboldatabase104);
TEST_CASE(symboldatabase105);

TEST_CASE(createSymbolDatabaseFindAllScopes1);
TEST_CASE(createSymbolDatabaseFindAllScopes2);
Expand Down Expand Up @@ -5551,6 +5552,24 @@ class TestSymbolDatabase : public TestFixture {
}
}

void symboldatabase105() {
{
GET_SYMBOL_DB_DBG("template <class T>\n"
"struct S : public std::deque<T> {\n"
" using std::deque<T>::clear;\n"
" void f();\n"
"};\n"
"template <class T>\n"
"void S<T>::f() {\n"
" clear();\n"
"}\n");
ASSERT(db != nullptr);
ASSERT_EQUALS("", errout.str());
const Token* const c = Token::findsimplematch(tokenizer.tokens(), "clear (");
ASSERT(!c->type());
}
}

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

0 comments on commit 43e4fac

Please sign in to comment.