diff options
| author | Ian Hattendorf | 2018-04-28 23:23:30 -0700 |
|---|---|---|
| committer | Martin Hořeňovský | 2018-04-29 20:28:35 +0200 |
| commit | 88a6ff0b65b375fcf1c502b2de3f8f360ecff649 (patch) | |
| tree | fdefb1fbed92eda0e897f1f3c92f01cb142e6107 /include | |
| parent | 9e7c281e6eec890e2f53f54fdbf1c8711b7e00b6 (diff) | |
| download | catch3-88a6ff0b65b375fcf1c502b2de3f8f360ecff649.tar.gz | |
Cast to unsigned char when using std::isalnum
std::isalnum expects an int in the range of unsigned char or -1 (EOF),
otherwise it exhibits undefined behavior. Casting from char to unsigned
char avoids this.
MSVC warns about this when compiling with /analyze.
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_test_case_info.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/internal/catch_test_case_info.cpp b/include/internal/catch_test_case_info.cpp index 9bf68912..46164221 100644 --- a/include/internal/catch_test_case_info.cpp +++ b/include/internal/catch_test_case_info.cpp @@ -37,7 +37,7 @@ namespace Catch { return TestCaseInfo::None; } bool isReservedTag( std::string const& tag ) { - return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] ); + return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast<unsigned char>(tag[0]) ); } void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { CATCH_ENFORCE( !isReservedTag(tag), |