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

Scoped parseInfos population so `i` can be reused

Commit
5fe19f73e72a2050af7ff4dbbdbd73bbaee76632
Author
Phil Nash ·
Parents
c1416d55cbca

Files · Download .tar.gz

Changes

 include/external/clara.hpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/external/clara.hpp b/include/external/clara.hpp
index b5947c8a..668d9e48 100644
--- a/include/external/clara.hpp
+++ b/include/external/clara.hpp
@@ -1145,9 +1145,12 @@ namespace detail {
             assert( totalParsers < 512 );
             // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do
             ParserInfo parseInfos[512];
-            size_t i = 0;
-            for( auto const& opt : m_options ) parseInfos[i++].parser = &opt;
-            for( auto const& arg : m_args ) parseInfos[i++].parser = &arg;
+
+            {
+                size_t i = 0;
+                for (auto const &opt : m_options) parseInfos[i++].parser = &opt;
+                for (auto const &arg : m_args) parseInfos[i++].parser = &arg;
+            }
 
             m_exeName.set( exeName );