diff --git a/src/cmd_context/tptp_frontend.cpp b/src/cmd_context/tptp_frontend.cpp index 1589c539a..bc277de42 100644 --- a/src/cmd_context/tptp_frontend.cpp +++ b/src/cmd_context/tptp_frontend.cpp @@ -1660,7 +1660,7 @@ class tptp_parser { std::string role = to_lower(parse_name()); expect(token_kind::comma, "','"); - if (!m_name_filters.empty() && !m_name_filters.back().contains(formula_name)) { + if (!m_name_filters.empty() && m_name_filters.back().find(formula_name) == m_name_filters.back().end()) { skip_annotations_until_rparen(); expect(token_kind::rparen, "')'"); expect(token_kind::dot, "'.'"); diff --git a/src/test/tptp.cpp b/src/test/tptp.cpp index 889f31098..42bd79d12 100644 --- a/src/test/tptp.cpp +++ b/src/test/tptp.cpp @@ -49,16 +49,22 @@ static void write_file(char const* path, char const* contents) { class scoped_temp_file { std::string m_path; public: + scoped_temp_file(scoped_temp_file const&) = delete; + scoped_temp_file& operator=(scoped_temp_file const&) = delete; + scoped_temp_file(scoped_temp_file&&) = delete; + scoped_temp_file& operator=(scoped_temp_file&&) = delete; + scoped_temp_file(char const* contents) { static std::atomic counter(0); - auto stamp = std::chrono::steady_clock::now().time_since_epoch().count(); + auto stamp = std::chrono::duration_cast( + std::chrono::steady_clock::now().time_since_epoch()).count(); m_path = (std::filesystem::temp_directory_path() / ("z3-tptp-" + std::to_string(stamp) + "-" + std::to_string(counter.fetch_add(1)) + ".p")).string(); write_file(m_path.c_str(), contents); } ~scoped_temp_file() { - if (!m_path.empty()) - std::remove(m_path.c_str()); + if (!m_path.empty() && std::remove(m_path.c_str()) != 0) + std::cerr << "failed to remove temporary file: " << m_path << "\n"; } std::string const& path() const { return m_path; } };