From c172e3be86c4e611be1d2cd088af79bf7b31144d Mon Sep 17 00:00:00 2001 From: R Date: Thu, 19 Nov 2026 13:12:51 -0300 Subject: [PATCH] hash: async_cobalt_test's promises are compiled without GCC 14's -Wmismatched-new-delete, which calls Boost.Cobalt's own operator new and delete of a coroutine frame a mismatched pair GCC 14 reports the pair of boost::cobalt::promise_memory_resource_base as mismatched (boostorg/cobalt#7) and -Werror makes it an error, as in webcpp::cobalt's own tests and webcpp::document's example, which suppress it the same way; GCC 15 does not report it. --- test/async_cobalt_test.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/async_cobalt_test.cpp b/test/async_cobalt_test.cpp index 4985acf..015879c 100644 --- a/test/async_cobalt_test.cpp +++ b/test/async_cobalt_test.cpp @@ -57,6 +57,15 @@ std::span bytes_of(std::string_view text) { return {reinterpret_cast(text.data()), text.size()}; } +// GCC 14 warns that each promise below, a coroutine, frees its frame with an operator delete that +// does not pair with the operator new that made it (-Wmismatched-new-delete); the pair is +// Boost.Cobalt's own, from its promise_memory_resource_base, and GCC 15 does not warn +// (boostorg/cobalt#7). +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 14 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmismatched-new-delete" +#endif + // The cheap functions, each awaited, against the synchronous function; and a refusal (an output of // 0 bytes) through as_tuple, and with exceptions through a throw. cobalt::promise cheap() { @@ -135,6 +144,10 @@ cobalt::promise browser() { } #endif +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 14 +#pragma GCC diagnostic pop +#endif + // Runs the context until `done`, a promise started on it, is ready, and reads it. void complete(webcpp::asio::io_context& context, cobalt::promise& done) { context.restart();