diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 49926cf77..36bbf08a1 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2443,10 +2443,16 @@ bool Function::argsMatch(const Scope *scope, const Token *first, const Token *se } // const after * - else if (first->next()->str() == "*" && first->strAt(2) != "const" && - second->next()->str() == "*" && second->strAt(2) == "const") { - first = first->next(); - second = second->tokAt(2); + else if (first->next()->str() == "*" && second->next()->str() == "*" && + ((first->strAt(2) != "const" && second->strAt(2) == "const") || + (first->strAt(2) == "const" && second->strAt(2) != "const"))) { + if (first->strAt(2) != "const") { + first = first->next(); + second = second->tokAt(2); + } else { + first = first->tokAt(2); + second = second->next(); + } } // variable names are different diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 5841c7674..feb685125 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -342,6 +342,7 @@ private: TEST_CASE(symboldatabase87); // #9922 'extern const char ( * x [ 256 ] ) ;' TEST_CASE(symboldatabase88); // #10040 (using namespace) TEST_CASE(symboldatabase89); // valuetype name + TEST_CASE(symboldatabase90); TEST_CASE(createSymbolDatabaseFindAllScopes1); @@ -4645,6 +4646,18 @@ private: ASSERT(vartok1->next()->variable()->valueType()->str() == "external::ns1::A"); } + void symboldatabase90() { + GET_SYMBOL_DB("struct Fred {\n" + " void foo(const int * const x);\n" + "};\n" + "void Fred::foo(const int * x) { }"); + ASSERT_EQUALS("", errout.str()); + const Token *functok = Token::findsimplematch(tokenizer.tokens(), "foo ( const int * x )"); + ASSERT(functok); + ASSERT(functok->function()); + ASSERT(functok->function()->name() == "foo"); + } + void createSymbolDatabaseFindAllScopes1() { GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }"); ASSERT(db->scopeList.size() == 3);