Reverted the previous change regarding warnings aboit slicing exceptions.

Apparently, slicing was intentional, and the test verified that it worked.
This commit restores the previous behavior and disables the gcc warning
instead.
This commit is contained in:
Andrey Semashev 2018-11-24 18:59:08 +03:00
parent 8e4a631231
commit 5a70ced692

View File

@ -291,6 +291,12 @@ namespace
// exception_tests() ---------------------------------------------------------------//
#if defined(BOOST_GCC) && BOOST_GCC >= 80000
#pragma GCC diagnostic push
// catching polymorphic type "X" by value - that's the intention of the test
#pragma GCC diagnostic ignored "-Wcatch-value"
#endif
void exception_tests()
{
cout << "exception_tests..." << endl;
@ -304,7 +310,7 @@ namespace
{
fs::create_directory("no-such-dir/foo/bar");
}
catch (std::runtime_error& x)
catch (std::runtime_error x)
{
exception_thrown = true;
if (report_throws) cout << x.what() << endl;
@ -325,7 +331,7 @@ namespace
{
fs::create_directory("no-such-dir/foo/bar");
}
catch (system_error& x)
catch (system_error x)
{
exception_thrown = true;
if (report_throws) cout << x.what() << endl;
@ -343,7 +349,7 @@ namespace
{
fs::create_directory("no-such-dir/foo/bar");
}
catch (fs::filesystem_error& x)
catch (fs::filesystem_error x)
{
exception_thrown = true;
if (report_throws) cout << x.what() << endl;
@ -368,7 +374,7 @@ namespace
{
fs::create_directory("no-such-dir/foo/bar");
}
catch (fs::filesystem_error& x)
catch (const fs::filesystem_error& x)
{
exception_thrown = true;
if (report_throws) cout << x.what() << endl;
@ -407,6 +413,10 @@ namespace
cout << " exception_tests complete" << endl;
}
#if defined(BOOST_GCC) && BOOST_GCC >= 80000
#pragma GCC diagnostic pop
#endif
// create a directory tree that can be used by subsequent tests ---------------------//
//
// dir