diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 46481805b..d58d4ca50 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -3834,6 +3834,13 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens) if (Token::simpleMatch(parsedecl(tok->next(), &valuetype), ")")) ::setValueType(tok, valuetype); } + + // function + if (tok->previous() && tok->previous()->function() && tok->previous()->function()->retDef) { + ValueType valuetype; + if (Token::simpleMatch(parsedecl(tok->previous()->function()->retDef, &valuetype), "(")) + ::setValueType(tok, valuetype); + } } else if (tok->variable()) { const Variable *var = tok->variable(); ValueType valuetype; diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 9cdf6fcb4..3c5ab5817 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -3009,6 +3009,9 @@ private: ASSERT_EQUALS("const int *", typeOf("const int *a; x = a + 1;", "a +")); ASSERT_EQUALS("int * const", typeOf("int * const a; x = a + 1;", "+")); ASSERT_EQUALS("const int *", typeOf("const int a[20]; x = a + 1;", "+")); + + // function call.. + ASSERT_EQUALS("int", typeOf("int a(int); a(5);", "( 5")); } };