code inspection [readability-simplify-boolean-expr] does not work propertly
std::map<int, int> map;
bool func()
{
auto a = map.find(123);
if (a==map.end())
{
a->second += 10;
return true;
}
return false;
}
this code will prompte "Redundant boolean literal in conditional return statement", which is incorrect I think.
Please sign in to leave a comment.
Hello,
Sorry, I do get readability-simplify-boolean-expr on your example. In any case, should not the condition be 'a != map.end()' in the if statement?
Oh, I made a mistake.
But in case of 'a != map.end()', it also get readability-simplify-boolean-expr.
I can not optimize it like 'return a!=map.end()' or something else
Could you please try creating a small project that has this issue and send it to us? We can then simplify it and file a bug with clang (since this is a clang-tidy inspection, not a R++ one). Thanks!
Sorry, but my PC with visual studio can not connect to internet.