diff --git a/src/catch2/benchmark/detail/catch_estimate_clock.hpp b/src/catch2/benchmark/detail/catch_estimate_clock.hpp index 984acd11..3bba791e 100644 --- a/src/catch2/benchmark/detail/catch_estimate_clock.hpp +++ b/src/catch2/benchmark/detail/catch_estimate_clock.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -94,7 +95,14 @@ namespace Catch { template Environment> measure_environment() { - static Environment>* env = nullptr; +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + static Catch::Detail::unique_ptr>> env; +#if defined(__clang__) +# pragma clang diagnostic pop +#endif if (env) { return *env; } @@ -103,7 +111,7 @@ namespace Catch { auto resolution = Detail::estimate_clock_resolution(iters); auto cost = Detail::estimate_clock_cost(resolution.mean); - env = new Environment>{ resolution, cost }; + env = Catch::Detail::make_unique>>( Environment>{resolution, cost} ); return *env; } } // namespace Detail