We just found an issue in our code base, where a statement is after a return statement.
e.g.
std::string MyClass::addElement(Type1 &item, const std::string ¶m2)
{
if (param2.empty())
{
// logging
return "";
}
return m_database->addElement(item, param2, item.status, true);
// here I would expect an unreachable code warning
m_database->updateTableA(item.p1, item.p2, item.p3, AType::AType23);
}
What I don't understand, why our compiler (GCC 4.8.5 and 7) does not emit a warning?
We compile with -std=c++0x -Wall -Wextra -Wsign-compare -Wunknown-pragmas -Wold-style-cast -Wshadow -Wfatal-errors