diff options
| author | Martin Hořeňovský | 2021-08-10 00:16:05 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-08-11 22:51:59 +0200 |
| commit | 3579c055c890b525d5e46f81aa9670521da28962 (patch) | |
| tree | a05add47eae3b505c5cfb1e20397ad7732dfb063 /src/catch2/catch_session.cpp | |
| parent | 3ec63324a823c19697720fda3eab1f18d297210c (diff) | |
| download | catch3-3579c055c890b525d5e46f81aa9670521da28962.tar.gz | |
Use Detail::make_unique<T> in more places
Diffstat (limited to 'src/catch2/catch_session.cpp')
| -rw-r--r-- | src/catch2/catch_session.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index edfef717..4419da4c 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -43,19 +43,13 @@ namespace Catch { return createReporter(config->getReporterName(), config); } - // On older platforms, returning unique_ptr<ListeningReporter> - // when the return type is unique_ptr<IStreamingReporter> - // 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 = Detail::unique_ptr<IStreamingReporter>(new ListeningReporter(config)); - auto& multi = static_cast<ListeningReporter&>(*ret); + auto multi = Detail::make_unique<ListeningReporter>(config); 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 ret; + multi->addReporter(createReporter(config->getReporterName(), config)); + return multi; } class TestGroup { |