Merge pull request #5859 from MathiasVP/fix-fp-in-comparison-with-wider-type

C++: Fix false positive in `cpp/comparison-with-wider-type`
This commit is contained in:
Mathias Vorreiter Pedersen
2021-05-10 17:58:31 +02:00
committed by GitHub
3 changed files with 12 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
void test_issue_5850(unsigned char small, unsigned int large1) {
for(; small < static_cast<unsigned char>(large1 - 1); small++) { } // GOOD
}
void test_widening(unsigned char small, char large) {
for(; small < static_cast<unsigned int>(static_cast<short>(large) - 1); small++) { } // GOOD
}