Fixed crash on invalid code #6080
This commit is contained in:
parent
7f2be2f57c
commit
0dc4b75565
|
@ -93,7 +93,7 @@ void CheckExceptionSafety::deallocThrow()
|
|||
tok = tok->next();
|
||||
if (Token::simpleMatch(tok, "[ ]"))
|
||||
tok = tok->tokAt(2);
|
||||
if (!tok)
|
||||
if (!tok || tok == scope->classEnd)
|
||||
break;
|
||||
if (!Token::Match(tok, "%var% ;"))
|
||||
continue;
|
||||
|
|
|
@ -49,6 +49,8 @@ private:
|
|||
TEST_CASE(nothrowAttributeThrow);
|
||||
TEST_CASE(nothrowAttributeThrow2); // #5703
|
||||
TEST_CASE(nothrowDeclspecThrow);
|
||||
|
||||
TEST_CASE(garbage);
|
||||
}
|
||||
|
||||
void check(const char code[], bool inconclusive = false) {
|
||||
|
@ -411,6 +413,10 @@ private:
|
|||
check("const char *func() __attribute((nothrow)); void func1() { return 0; }\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void garbage() {
|
||||
check("{ } A() { delete }"); // #6080
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestExceptionSafety)
|
||||
|
|
Loading…
Reference in New Issue