Skip to content

Commit 43e4fac

Browse files
Don't set type for simplified using declarations (f'up to #8454) (#6088)
1 parent 7e42652 commit 43e4fac

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/symboldatabase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
390390
}
391391

392392
// using type alias
393-
else if (mTokenizer.isCPP() && tok->isKeyword() && Token::Match(tok, "using %name% =")) {
393+
else if (mTokenizer.isCPP() && tok->isKeyword() && Token::Match(tok, "using %name% =") && !tok->tokAt(2)->isSimplifiedTypedef()) {
394394
if (tok->strAt(-1) != ">" && !findType(tok->next(), scope)) {
395395
// fill typeList..
396396
typeList.emplace_back(tok, nullptr, scope);

test/testsymboldatabase.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ class TestSymbolDatabase : public TestFixture {
421421
TEST_CASE(symboldatabase102);
422422
TEST_CASE(symboldatabase103);
423423
TEST_CASE(symboldatabase104);
424+
TEST_CASE(symboldatabase105);
424425

425426
TEST_CASE(createSymbolDatabaseFindAllScopes1);
426427
TEST_CASE(createSymbolDatabaseFindAllScopes2);
@@ -5551,6 +5552,24 @@ class TestSymbolDatabase : public TestFixture {
55515552
}
55525553
}
55535554

5555+
void symboldatabase105() {
5556+
{
5557+
GET_SYMBOL_DB_DBG("template <class T>\n"
5558+
"struct S : public std::deque<T> {\n"
5559+
" using std::deque<T>::clear;\n"
5560+
" void f();\n"
5561+
"};\n"
5562+
"template <class T>\n"
5563+
"void S<T>::f() {\n"
5564+
" clear();\n"
5565+
"}\n");
5566+
ASSERT(db != nullptr);
5567+
ASSERT_EQUALS("", errout.str());
5568+
const Token* const c = Token::findsimplematch(tokenizer.tokens(), "clear (");
5569+
ASSERT(!c->type());
5570+
}
5571+
}
5572+
55545573
void createSymbolDatabaseFindAllScopes1() {
55555574
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
55565575
ASSERT(db->scopeList.size() == 3);

0 commit comments

Comments
 (0)