From 79f01100e33cb28af06be67da9755e36566970dc Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 14 Oct 2016 14:08:57 -0700 Subject: [PATCH] Fix transform narrowing warnings Catch passes ::tolower into std::transform with string iterators. ::tolower has the signature int(int), which triggers a stealth narrowing warning inside std::transform, because transform calls *_Dest = _Fn(*_First), which implicitly narrows an int to a char. For this particular application the narrowing is fine, so explicitly narrow in a lambda. --- include/internal/catch_common.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/internal/catch_common.hpp b/include/internal/catch_common.hpp index 2342ae61..87743ccb 100644 --- a/include/internal/catch_common.hpp +++ b/include/internal/catch_common.hpp @@ -22,7 +22,8 @@ namespace Catch { return s.find( infix ) != std::string::npos; } void toLowerInPlace( std::string& s ) { - std::transform( s.begin(), s.end(), s.begin(), ::tolower ); + std::transform( s.begin(), s.end(), s.begin(), + [](char c) { return static_cast(::tolower(c)); } ); } std::string toLower( std::string const& s ) { std::string lc = s;