Update test.cpp

This commit is contained in:
ihsinme
2021-07-21 09:48:36 +03:00
committed by GitHub
parent 1e12ede9fa
commit 4202759bcc

View File

@@ -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();