diff --git a/include/internal/catch_session.cpp b/include/internal/catch_session.cpp index 0920521c..6224fbe6 100644 --- a/include/internal/catch_session.cpp +++ b/include/internal/catch_session.cpp @@ -42,14 +42,19 @@ namespace Catch { return createReporter(config->getReporterName(), config); } - auto multi = std::unique_ptr(new ListeningReporter); - + // On older platforms, returning std::unique_ptr + // when the return type is std::unique_ptr + // doesn't compile without a std::move call. However, this causes + // a warning on newer platforms. Thus, we have to work around + // it a bit and downcast the pointer manually. + auto ret = std::unique_ptr(new ListeningReporter); + auto& multi = static_cast(*ret); auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); for (auto const& listener : listeners) { - multi->addListener(listener->create(Catch::ReporterConfig(config))); + multi.addListener(listener->create(Catch::ReporterConfig(config))); } - multi->addReporter(createReporter(config->getReporterName(), config)); - return std::move(multi); + multi.addReporter(createReporter(config->getReporterName(), config)); + return ret; }