diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 21add8f86..f19270113 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -4468,6 +4468,13 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens, bool cpp, char defau ValueType valuetype(ValueType::Sign::UNSIGNED, ValueType::Type::LONG, 0U); valuetype.originalTypeName = "size_t"; setValueType(tok, valuetype, cpp, defsign, lib); + + if (Token::Match(tok, "( %type% %type%| *| *| )")) { + ValueType vt; + if (parsedecl(tok->next(), &vt, defsign, lib)) { + setValueType(tok->next(), vt, cpp, defsign, lib); + } + } } } else if (tok->variable()) { setValueType(tok, *tok->variable(), cpp, defsign, lib); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 53bf89c15..ca0aa7018 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -3626,6 +3626,9 @@ private: ASSERT_EQUALS("char", typeOf("a = static_cast(32);", "(")); ASSERT_EQUALS("", typeOf("a = (unsigned x)0;", "(")); + // sizeof.. + ASSERT_EQUALS("char", typeOf("sizeof(char)", "char")); + // const.. ASSERT_EQUALS("const char *", typeOf("a = \"123\";", "\"123\"")); ASSERT_EQUALS("const signed int *", typeOf("const int *a; x = a + 1;", "a +"));