Skip to content

Commit

Permalink
A different approach
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Dec 27, 2018
1 parent dbdd26b commit 7d7428f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions include/internal/catch_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 multi;
multi.addReporter(createReporter(config->getReporterName(), config));
return ret;
}


Expand Down

0 comments on commit 7d7428f

Please sign in to comment.