Remove redundant move to avoid Wredundant-move with Clang

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2018-12-17 17:27:43 -08:00 committed by Martin Hořeňovský
parent 9bc15939a5
commit 799c7a2eed

View File

@ -42,14 +42,19 @@ namespace Catch {
return createReporter(config->getReporterName(), config);
}
auto multi = std::unique_ptr<ListeningReporter>(new ListeningReporter);
// On older platforms, returning std::unique_ptr<ListeningReporter>
// when the return type is std::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 = std::unique_ptr<IStreamingReporter>(new ListeningReporter);
auto& multi = static_cast<ListeningReporter&>(*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;
}