mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Remove redundant move to avoid Wredundant-move with Clang
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
9bc15939a5
commit
799c7a2eed
@ -42,14 +42,19 @@ namespace Catch {
|
|||||||
return createReporter(config->getReporterName(), config);
|
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();
|
auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
|
||||||
for (auto const& listener : listeners) {
|
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));
|
multi.addReporter(createReporter(config->getReporterName(), config));
|
||||||
return std::move(multi);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user