diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 952e692bc..2033349ee 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -6508,7 +6508,7 @@ static const Token* parsedecl(const Token* type, } else if (const Library::SmartPointer* smartPointer = settings->library.detectSmartPointer(type)) { const Token* argTok = Token::findsimplematch(type, "<"); if (!argTok) - continue; + break; valuetype->smartPointer = smartPointer; valuetype->smartPointerTypeToken = argTok->next(); valuetype->smartPointerType = argTok->next()->type(); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 4030da2c1..959d19541 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -490,6 +490,7 @@ private: TEST_CASE(auto14); TEST_CASE(auto15); // C++17 auto deduction from braced-init-list TEST_CASE(auto16); + TEST_CASE(auto17); // #11163 TEST_CASE(unionWithConstructor); @@ -8601,6 +8602,18 @@ private: ASSERT_EQUALS(ValueType::Type::RECORD, i->valueType()->type); } + void auto17() { // #11163 don't hang + GET_SYMBOL_DB("void f() {\n" + " std::shared_ptr s1;\n" + " auto s2 = std::shared_ptr(s1);\n" + "}\n" + "void g() {\n" + " std::shared_ptr s;\n" + " auto w = std::weak_ptr(s);\n" + "}\n"); + ASSERT_EQUALS(5, db->variableList().size()); + } + void unionWithConstructor() { GET_SYMBOL_DB("union Fred {\n" " Fred(int x) : i(x) { }\n"