Fixed crash on range-based for-loop
This commit is contained in:
parent
7ece58c3a0
commit
11fa185cae
|
@ -313,6 +313,9 @@ void CheckStl::stlOutOfBounds()
|
||||||
tok = tok->linkAt(1)->tokAt(2);
|
tok = tok->linkAt(1)->tokAt(2);
|
||||||
} else
|
} else
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
|
if (!tok)
|
||||||
|
continue;
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
// check if the for loop condition is wrong
|
// check if the for loop condition is wrong
|
||||||
|
|
|
@ -577,6 +577,11 @@ private:
|
||||||
" foo[ii] = 0;\n"
|
" foo[ii] = 0;\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("void foo() {\n"
|
||||||
|
" for (B b : D()) {}\n" // Don't crash on range-based for-loop
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void STLSizeNoErr() {
|
void STLSizeNoErr() {
|
||||||
|
|
Loading…
Reference in New Issue