Fix issue 10235: Regression: oppositeInnerCondition (#3223)
This commit is contained in:
parent
5768c3a726
commit
691f681d86
|
@ -650,6 +650,8 @@ bool exprDependsOnThis(const Token* expr, nonneg int depth)
|
|||
{
|
||||
if (!expr)
|
||||
return false;
|
||||
if (expr->str() == "this")
|
||||
return true;
|
||||
if (depth >= 1000)
|
||||
// Abort recursion to avoid stack overflow
|
||||
return true;
|
||||
|
|
|
@ -2429,6 +2429,20 @@ private:
|
|||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct CD {\n"
|
||||
" bool state;\n"
|
||||
" void foo() {\n"
|
||||
" const bool flag = this->get();\n"
|
||||
" if (flag) {\n"
|
||||
" this->bar();\n"
|
||||
" if (!this->get()) return;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" bool get() const;\n"
|
||||
" void bar();\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("class C {\n"
|
||||
"public:\n"
|
||||
" bool f() const { return x > 0; }\n"
|
||||
|
|
Loading…
Reference in New Issue