C++: Suppress pointless compare in template inst.

It still runs on uninstantiated templates because its underlying
libraries do. It's not clear whether that leads to other false
positives, but that's independent of the change I'm making here.
This commit is contained in:
Jonas Jensen
2018-10-03 14:32:44 +02:00
parent 2eea359f79
commit 364c9a6961
3 changed files with 4 additions and 5 deletions

View File

@@ -32,7 +32,4 @@
| PointlessComparison.c:129:12:129:16 | ... > ... | Comparison is always false because a <= 3. |
| PointlessComparison.c:197:7:197:11 | ... < ... | Comparison is always false because x >= 0. |
| RegressionTests.cpp:57:7:57:22 | ... <= ... | Comparison is always true because * ... <= 4294967295. |
| Templates.cpp:3:10:3:24 | ... <= ... | Comparison is always true because param <= 32767. |
| Templates.cpp:9:10:9:24 | ... <= ... | Comparison is always true because local <= 32767. |
| Templates.cpp:9:10:9:24 | ... <= ... | Comparison is always true because local <= 32767. |
| Templates.cpp:9:10:9:24 | ... <= ... | Comparison is always true because local <= 32767. |

View File

@@ -1,6 +1,6 @@
template<typename T>
bool sometimesPointless(T param) {
return param <= 0xFFFF; // GOOD (FALSE POSITIVE: hypothetical instantiations are okay)
return param <= 0xFFFF; // GOOD (hypothetical instantiations are okay)
}
template<typename T>