diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index a6df45740..ca1a2c3c5 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -4648,7 +4648,16 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V valuetype->sign = ValueType::Sign::UNSIGNED; if (type->str() == "const") valuetype->constness |= (1 << (valuetype->pointer - pointer0)); - else if (ValueType::Type t = ValueType::typeFromString(type->str(), type->isLong())) + else if (Token::Match(type, "%name% :: %name%")) { + std::string typestr; + const Token *end = type; + while (Token::Match(end, "%name% :: %name%")) { + typestr += end->str() + "::"; + end = end->tokAt(2); + } + if (valuetype->fromLibraryType(typestr + end->str(), settings)) + type = end; + } else if (ValueType::Type t = ValueType::typeFromString(type->str(), type->isLong())) valuetype->type = t; else if (type->str() == "auto") { if (!type->valueType()) diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index a9bef248c..683137548 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -4289,10 +4289,13 @@ private: settingsWin64.platformType = Settings::Win64; const Library::PodType u32 = { 4, 'u' }; settingsWin64.library.podtypes["u32"] = u32; + settingsWin64.library.podtypes["xyz::u32"] = u32; ValueType vt; ASSERT_EQUALS(true, vt.fromLibraryType("u32", &settingsWin64)); + ASSERT_EQUALS(true, vt.fromLibraryType("xyz::u32", &settingsWin64)); ASSERT_EQUALS(ValueType::Type::INT, vt.type); ASSERT_EQUALS("unsigned int *", typeOf(";void *data = new u32[10];", "new", "test.cpp", &settingsWin64)); + ASSERT_EQUALS("unsigned int", typeOf("; x = (xyz::u32)12;", "(", "test.cpp", &settingsWin64)); } { // PlatformType