SymbolDatabase: Fix type for expression 'x = uint8_t(a[b])'

This commit is contained in:
Daniel Marjamäki 2019-10-22 20:40:36 +02:00
parent cf1dd2e6f6
commit c5c07b61a6
2 changed files with 7 additions and 0 deletions

View File

@ -5700,6 +5700,12 @@ void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings)
continue; continue;
} }
} }
ValueType podtype;
if (podtype.fromLibraryType(e, mSettings)) {
setValueType(tok, podtype);
continue;
}
} }
const std::string& typestr(mSettings->library.returnValueType(tok->previous())); const std::string& typestr(mSettings->library.returnValueType(tok->previous()));

View File

@ -6568,6 +6568,7 @@ private:
ASSERT_EQUALS("unsigned int *", typeOf(";void *data = new xyz::x[10];", "new", "test.cpp", &settingsWin64)); ASSERT_EQUALS("unsigned int *", typeOf(";void *data = new xyz::x[10];", "new", "test.cpp", &settingsWin64));
ASSERT_EQUALS("unsigned int", typeOf("; x = (xyz::x)12;", "(", "test.cpp", &settingsWin64)); ASSERT_EQUALS("unsigned int", typeOf("; x = (xyz::x)12;", "(", "test.cpp", &settingsWin64));
ASSERT_EQUALS("unsigned int", typeOf(";u32(12);", "(", "test.cpp", &settingsWin64)); ASSERT_EQUALS("unsigned int", typeOf(";u32(12);", "(", "test.cpp", &settingsWin64));
ASSERT_EQUALS("unsigned int", typeOf("x = u32(y[i]);", "(", "test.cpp", &settingsWin64));
} }
{ {
// PlatformType // PlatformType