diff --git a/lib/astutils.cpp b/lib/astutils.cpp index d7926d83b..bff663e01 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -1578,7 +1578,7 @@ bool isLikelyStreamRead(bool cpp, const Token *op) const Token *parent = op; while (parent->astParent() && parent->astParent()->str() == op->str()) parent = parent->astParent(); - if (parent->astParent() && !Token::Match(parent->astParent(), "%oror%|&&|(|,|!")) + if (parent->astParent() && !Token::Match(parent->astParent(), "%oror%|&&|(|,|.|!")) return false; if (op->str() == "&" && parent->astParent()) return false; diff --git a/test/testother.cpp b/test/testother.cpp index 654cf6734..69e759fd7 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1977,6 +1977,12 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + check("bool from_string(int& t, const std::string& s) {\n" + " std::istringstream iss(s);\n" + " return !(iss >> t).fail();\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + check("void e();\n" "void g(void);\n" "void h(void);\n"