#5703 - Segfault recursive loop - Patch by zingsheim
This commit is contained in:
parent
623e5db0b2
commit
2c3807f089
|
@ -181,7 +181,7 @@ void CheckExceptionSafety::checkCatchExceptionByValue()
|
||||||
static const Token * functionThrowsRecursive(const Function * function, std::set<const Function *> & recursive)
|
static const Token * functionThrowsRecursive(const Function * function, std::set<const Function *> & recursive)
|
||||||
{
|
{
|
||||||
// check for recursion and bail if found
|
// check for recursion and bail if found
|
||||||
if (recursive.find(function) != recursive.end())
|
if (!recursive.insert(function).second)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!function->functionScope)
|
if (!function->functionScope)
|
||||||
|
|
|
@ -46,6 +46,7 @@ private:
|
||||||
TEST_CASE(nothrowThrow);
|
TEST_CASE(nothrowThrow);
|
||||||
TEST_CASE(unhandledExceptionSpecification); // #4800
|
TEST_CASE(unhandledExceptionSpecification); // #4800
|
||||||
TEST_CASE(nothrowAttributeThrow);
|
TEST_CASE(nothrowAttributeThrow);
|
||||||
|
TEST_CASE(nothrowAttributeThrow2); // #5703
|
||||||
}
|
}
|
||||||
|
|
||||||
void check(const char code[], bool inconclusive = false) {
|
void check(const char code[], bool inconclusive = false) {
|
||||||
|
@ -372,6 +373,15 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nothrowAttributeThrow2() {
|
||||||
|
check("class foo {\n"
|
||||||
|
" void copyMemberValues() throw () {\n"
|
||||||
|
" copyMemberValues();\n"
|
||||||
|
" }\n"
|
||||||
|
"};\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TEST(TestExceptionSafety)
|
REGISTER_TEST(TestExceptionSafety)
|
||||||
|
|
Loading…
Reference in New Issue