Avoid needless copy in handling fatal errors

This commit is contained in:
Martin Hořeňovský 2025-07-16 21:50:20 +02:00
parent 066f00acf5
commit 895b8af6bd
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -484,8 +484,8 @@ namespace Catch {
// Best effort cleanup for sections that have not been destructed yet // Best effort cleanup for sections that have not been destructed yet
// Since this is a fatal error, we have not had and won't have the opportunity to destruct them properly // Since this is a fatal error, we have not had and won't have the opportunity to destruct them properly
while (!m_activeSections.empty()) { while (!m_activeSections.empty()) {
auto nl = m_activeSections.back()->nameAndLocation(); auto const& nl = m_activeSections.back()->nameAndLocation();
SectionEndInfo endInfo{ SectionInfo(CATCH_MOVE(nl.location), CATCH_MOVE(nl.name)), {}, 0.0 }; SectionEndInfo endInfo{ SectionInfo(nl.location, nl.name), {}, 0.0 };
sectionEndedEarly(CATCH_MOVE(endInfo)); sectionEndedEarly(CATCH_MOVE(endInfo));
} }
handleUnfinishedSections(); handleUnfinishedSections();