Fixed #7248 (crash in ValueType::str())

This commit is contained in:
Daniel Marjamäki 2016-01-01 15:13:50 +01:00
parent 1e0979779e
commit 2f26195b23
2 changed files with 4 additions and 1 deletions

View File

@ -3934,5 +3934,5 @@ std::string ValueType::str() const
if (constness & (2 << p))
ret += " const";
}
return ret.substr(1);
return ret.empty() ? ret : ret.substr(1);
}

View File

@ -3008,6 +3008,9 @@ private:
}
void valuetype() {
// stringification
ASSERT_EQUALS("", ValueType().str());
// numbers
ASSERT_EQUALS("signed int", typeOf("1", "1"));
ASSERT_EQUALS("unsigned int", typeOf("1U", "1U"));