File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2574,7 +2574,7 @@ struct SingleValueFlowForwardAnalyzer : ValueFlowForwardAnalyzer {
25742574 virtual bool isGlobal () const OVERRIDE {
25752575 for (const auto &p:getVars ()) {
25762576 const Variable* var = p.second ;
2577- if (var->isGlobal () && !var->isConst ())
2577+ if (! var->isLocal () && !var-> isArgument () && !var->isConst ())
25782578 return true ;
25792579 }
25802580 return false ;
Original file line number Diff line number Diff line change @@ -3588,6 +3588,17 @@ class TestCondition : public TestFixture {
35883588 " return;\n "
35893589 " }\n " );
35903590 ASSERT_EQUALS (" " , errout.str ());
3591+
3592+ check (" struct A {\n "
3593+ " std::vector<int> v;\n "
3594+ " void g();\n "
3595+ " void f(bool b) {\n "
3596+ " v.clear();\n "
3597+ " g();\n "
3598+ " return !v.empty();\n "
3599+ " }\n "
3600+ " };\n " );
3601+ ASSERT_EQUALS (" " , errout.str ());
35913602 }
35923603
35933604 void multiConditionAlwaysTrue () {
You can’t perform that action at this time.
0 commit comments