Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Fixes compiler error for some versions of GCC

- Manual application of PR #196 (couldn’t merge)
- See also #226
Commit
9e529853ee1a30d569fe4c2586131b1ac29202b3
Author
Phil Nash ·
Parents
66d641af64fe

Files · Download .tar.gz

Changes

 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<SectionNode> const& node, SectionInfo const& other ) {
-            return node->stats.sectionInfo.lineInfo == other.lineInfo;
-        }
+
+        struct BySectionInfo {
+            BySectionInfo( SectionInfo const& other ) : m_other( other ) {}
+            bool operator() ( Ptr<SectionNode> const& node ) const {
+                return node->stats.sectionInfo.lineInfo == m_other.lineInfo;
+            }
+        private:
+            SectionInfo const& m_other;
+        };
+
 
         typedef Node<TestCaseStats, SectionNode> TestCaseNode;
         typedef Node<TestGroupStats, TestCaseNode> 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 );