mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Update test.cpp
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
namespace std
|
||||
{
|
||||
class exception {
|
||||
};
|
||||
|
||||
class runtime_error : public exception {
|
||||
public:
|
||||
runtime_error(const char *msg);
|
||||
};
|
||||
}
|
||||
|
||||
typedef unsigned int size_t;
|
||||
void clean();
|
||||
|
||||
@@ -18,6 +29,13 @@ void funcTest2()
|
||||
try { throw "my exception!"; } // GOOD
|
||||
catch (...) { clean(); }
|
||||
}
|
||||
|
||||
void funcTest3()
|
||||
{
|
||||
std::runtime_error("msg error"); // BAD
|
||||
throw std::runtime_error("msg error"); // GOOD
|
||||
}
|
||||
|
||||
void TestFunc()
|
||||
{
|
||||
funcTest1();
|
||||
|
||||
Reference in New Issue
Block a user