diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc index 23fb6182825d..f12290adaeea 100644 --- a/libstdc++-v3/src/c++11/system_error.cc +++ b/libstdc++-v3/src/c++11/system_error.cc @@ -338,7 +338,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_THROW_OR_ABORT(system_error(error_code(__i, generic_category()))); } - error_category::~error_category() noexcept = default; + error_category::~error_category() = default; const error_category& _V2::system_category() noexcept { return system_category_instance; } @@ -346,7 +346,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const error_category& _V2::generic_category() noexcept { return generic_category_instance; } - system_error::~system_error() noexcept = default; + system_error::~system_error() = default; error_condition error_category::default_error_condition(int __i) const noexcept diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/noexcept.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/noexcept.cc new file mode 100644 index 000000000000..210344c76071 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/noexcept.cc @@ -0,0 +1,13 @@ +// { dg-do compile { target c++11 } } +#include + +extern const std::error_category& cat; + +static_assert(std::is_nothrow_destructible::value, ""); +static_assert(noexcept(cat.name()), ""); +static_assert(noexcept(cat.default_error_condition(1)), ""); +static_assert(noexcept(cat.equivalent(1, {})), ""); +static_assert(noexcept(cat.equivalent({}, 1)), ""); +static_assert(noexcept(cat == cat), ""); +static_assert(noexcept(cat != cat), ""); +static_assert(noexcept(cat < cat), ""); diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/noexcept.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/noexcept.cc new file mode 100644 index 000000000000..853b7f922b64 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/noexcept.cc @@ -0,0 +1,6 @@ +// { dg-do compile { target c++11 } } +#include + +static_assert(std::is_nothrow_destructible::value, ""); +static_assert(noexcept(std::declval().code()), ""); +static_assert(noexcept(std::declval().what()), "");