mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 19:33:29 +01:00
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.
This commit is contained in:
parent
9e7c281e6e
commit
88a6ff0b65
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user