From 71b969dec9885b446470982cc1da8bc5232a12ce Mon Sep 17 00:00:00 2001 From: Andrew Foster Date: Mon, 10 Oct 2016 11:21:22 +0100 Subject: [PATCH] Fixed const_reverse_iterator compile error with Oracle Solaris Studio 12.1 Building Catch with Oracle Solaris Studio 12.1 generates an error because it is unable to convert from a std::vector<>::reverse_iterator to a std::vector<>::const_reverse_iterator. This is easily avoided by using a constant reference to the type before obtaining the iterator. --- include/internal/catch_run_context.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index d37bdba1..c6a34906 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -327,8 +327,9 @@ namespace Catch { void handleUnfinishedSections() { // If sections ended prematurely due to an exception we stored their // infos here so we can tear them down outside the unwind process. - for( std::vector::const_reverse_iterator it = m_unfinishedSections.rbegin(), - itEnd = m_unfinishedSections.rend(); + std::vector const& constUnfinishedSections = m_unfinishedSections; + for( std::vector::const_reverse_iterator it = constUnfinishedSections.rbegin(), + itEnd = constUnfinishedSections.rend(); it != itEnd; ++it ) sectionEnded( *it );