Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorIan Hattendorf2018-04-28 23:23:30 -0700
committerMartin Hořeňovský2018-04-29 20:28:35 +0200
commit88a6ff0b65b375fcf1c502b2de3f8f360ecff649 (patch)
treefdefb1fbed92eda0e897f1f3c92f01cb142e6107 /include
parent9e7c281e6eec890e2f53f54fdbf1c8711b7e00b6 (diff)
downloadcatch3-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.cpp2
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),