diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 5bf6ca913..6b61fda3b 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -278,7 +278,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes() // using type alias else if (_tokenizer->isCPP() && Token::Match(tok, "using %name% =")) { - if (!findType(tok->next(), scope)) { + if (tok->strAt(-1) != ">" && !findType(tok->next(), scope)) { // fill typeList.. typeList.push_back(Type(tok, nullptr, scope)); Type* new_type = &typeList.back(); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index b0101feae..920fcd0ef 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -351,7 +351,8 @@ private: TEST_CASE(unionWithConstructor); TEST_CASE(using1); - TEST_CASE(using2); // #8331 + TEST_CASE(using2); // #8331 (segmentation fault) + TEST_CASE(using3); // #8343 (segmentation fault) } void array() { @@ -5390,6 +5391,17 @@ private: settings1.standards.cpp = original_std; } + void using3() { // #8343 (segmentation fault) + Standards::cppstd_t original_std = settings1.standards.cpp; + settings1.standards.cpp = Standards::CPP11; + GET_SYMBOL_DB("template \n" + "using vector = typename MemoryModel::template vector;\n" + "vector m_bits;"); + settings1.standards.cpp = original_std; + + ASSERT(db); + ASSERT_EQUALS("", errout.str()); + } }; REGISTER_TEST(TestSymbolDatabase)