From 9e529853ee1a30d569fe4c2586131b1ac29202b3 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 18 Dec 2013 08:37:23 +0000 Subject: [PATCH] =?UTF-8?q?Fixes=20compiler=20error=20for=20some=20version?= =?UTF-8?q?s=20of=20GCC=20-=20Manual=20application=20of=20PR=20#196=20(cou?= =?UTF-8?q?ldn=E2=80=99t=20merge)=20-=20See=20also=20#226?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/reporters/catch_reporter_bases.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index 451b5a75..21e70980 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -92,9 +92,16 @@ namespace Catch { std::string stdOut; std::string stdErr; }; - friend bool operator == ( Ptr const& node, SectionInfo const& other ) { - return node->stats.sectionInfo.lineInfo == other.lineInfo; - } + + struct BySectionInfo { + BySectionInfo( SectionInfo const& other ) : m_other( other ) {} + bool operator() ( Ptr const& node ) const { + return node->stats.sectionInfo.lineInfo == m_other.lineInfo; + } + private: + SectionInfo const& m_other; + }; + typedef Node TestCaseNode; typedef Node TestGroupNode; @@ -122,7 +129,9 @@ namespace Catch { else { SectionNode& parentNode = *m_sectionStack.back(); SectionNode::ChildSections::const_iterator it = - std::find( parentNode.childSections.begin(), parentNode.childSections.end(), sectionInfo ); + std::find_if( parentNode.childSections.begin(), + parentNode.childSections.end(), + BySectionInfo( sectionInfo ) ); if( it == parentNode.childSections.end() ) { node = new SectionNode( incompleteStats ); parentNode.childSections.push_back( node );