diff --git a/test/lib/tmpdir.cc b/test/lib/tmpdir.cc index 7c123ea87f..98c6d0628d 100644 --- a/test/lib/tmpdir.cc +++ b/test/lib/tmpdir.cc @@ -21,7 +21,14 @@ #include "test/lib/tmpdir.hh" -void tmpdir::remove() { +#include + +// This is not really noexcept. But it is used only from the +// destructor and move assignment operators which have to be +// noexcept. This is only for testing, so a std::unexpected call if if +// remove fails is fine. +void tmpdir::remove() noexcept { + memory::disable_failure_guard dfg; if (!_path.empty()) { fs::remove_all(_path); } diff --git a/test/lib/tmpdir.hh b/test/lib/tmpdir.hh index b92b99e0ca..150ef2f8d8 100644 --- a/test/lib/tmpdir.hh +++ b/test/lib/tmpdir.hh @@ -35,7 +35,7 @@ class tmpdir { fs::path _path; private: - void remove(); + void remove() noexcept; public: tmpdir();