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

Keep toLower free of a sign conversion

`isUpper << 5` promotes the bool to int, so or-ing it into the
unsigned value converted a signed int and failed -Wsign-conversion.
Shift an unsigned value instead; the result is the same for every char.
Commit
646dfa6599c09bc60041c8dc5a0ff7243b215504
Author
Leitwolf11 ·
Parents
d06447420eca

Files · Download .tar.gz

Changes

 src/Progmasoft/Catch3/Internal/StringManip.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Progmasoft/Catch3/Internal/StringManip.hpp b/src/Progmasoft/Catch3/Internal/StringManip.hpp
index 474d6e55..7b43d045 100644
--- a/src/Progmasoft/Catch3/Internal/StringManip.hpp
+++ b/src/Progmasoft/Catch3/Internal/StringManip.hpp
@@ -28,7 +28,7 @@ namespace Catch {
     constexpr char toLower( char c ) {
         const uint32_t as_number = static_cast<unsigned char>( c );
         const bool isUpper = ( as_number - static_cast<uint32_t>( 'A' ) ) < 26u;
-        return static_cast<char>( as_number | ( isUpper << 5 ) );
+        return static_cast<char>( as_number | ( static_cast<uint32_t>( isUpper ) << 5u ) );
     }
     //! Returns a new string without whitespace at the start/end
     std::string trim( std::string const& str );