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

Fix template args to avoid conversion warnings

Fix avoids a warning about sign conversion when included from a file compiled with -Werror=sign-conversion.
Commit
2db1cf34047f76cb2679a3804b476881536ad27b
Author
SketchyLizard ·
Committer
Martin Hořeňovský
Parents
fabe614ba8fc

Files · Download .tar.gz

Changes

 src/catch2/catch_tostring.hpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp
index 0bbf989c..9182a119 100644
--- a/src/catch2/catch_tostring.hpp
+++ b/src/catch2/catch_tostring.hpp
@@ -205,7 +205,7 @@ namespace Catch {
     };
 #endif // CATCH_CONFIG_WCHAR
 
-    template<int SZ>
+    template<size_t SZ>
     struct StringMaker<char[SZ]> {
         static std::string convert(char const* str) {
             // Note that `strnlen` is not actually part of standard C++,
@@ -214,7 +214,7 @@ namespace Catch {
                 StringRef( str, strnlen( str, SZ ) ) );
         }
     };
-    template<int SZ>
+    template<size_t SZ>
     struct StringMaker<signed char[SZ]> {
         static std::string convert(signed char const* str) {
             // See the plain `char const*` overload
@@ -223,7 +223,7 @@ namespace Catch {
                 StringRef(reinterpreted, strnlen(reinterpreted, SZ)));
         }
     };
-    template<int SZ>
+    template<size_t SZ>
     struct StringMaker<unsigned char[SZ]> {
         static std::string convert(unsigned char const* str) {
             // See the plain `char const*` overload
@@ -522,7 +522,7 @@ namespace Catch {
         }
     };
 
-    template <typename T, int SZ>
+    template <typename T, size_t SZ>
     struct StringMaker<T[SZ]> {
         static std::string convert(T const(&arr)[SZ]) {
             return rangeToString(arr);