Reputation: 15009
We have the following code:
class Foo {
std::map<const uint8_t, double> m_throttle;
// ...
void bar(const uint8_t &msg_id)
{
if (m_throttle.find(msg_id) == m_throttle.end())
{
// Whatever
}
}
};
This produces the following error from the QA-C code checker when applying the MISRA C++ 2008 rules, highlighting the msg_id
as the problematic token:
05-00-03 複合式が暗黙的に異なる本質型へ変換されています。
Or in English:
Complex expressions are implicitly converted to different intrinsic types.
According to the PDF here, fuller text is:
A cvalue expression shall not be implicitly converted to a different underlying type
However, the implementation of std::map::find()
is just:
iterator
find(const key_type& __x)
{ return _M_t.find(__x); }
Where key_type
should be uint8_t
. Is this a bug in the tool, or is there something I am missing?
Note the tool uses the currently-installed gcc
, apparently, which is 5.4.0.
Upvotes: 0
Views: 189