mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
C++: Add false positive.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
| templates.cpp:17:5:17:25 | ... < ... | Self comparison. |
|
||||
| templates.cpp:31:20:31:41 | ... <= ... | Self comparison. |
|
||||
| test.cpp:13:11:13:21 | ... == ... | Self comparison. |
|
||||
| test.cpp:79:11:79:32 | ... == ... | Self comparison. |
|
||||
| test.cpp:83:10:83:15 | ... == ... | Self comparison. |
|
||||
|
||||
@@ -20,3 +20,22 @@ bool compareValues() {
|
||||
bool callCompareValues() {
|
||||
return compareValues<C1, C2> || compareValues<C1, C1>();
|
||||
}
|
||||
|
||||
template <bool C, typename T = void>
|
||||
struct enable_if {};
|
||||
|
||||
template <typename T>
|
||||
struct enable_if<true, T> { typedef T type; };
|
||||
|
||||
template<typename T1, typename T2>
|
||||
typename enable_if<T1::value <= T2::value, bool>::type constant_comparison() {
|
||||
return true;
|
||||
}
|
||||
|
||||
struct Value0 {
|
||||
const static int value = 0;
|
||||
};
|
||||
|
||||
void instantiation_with_pointless_comparison() {
|
||||
constant_comparison<Value0, Value0>();
|
||||
}
|
||||
Reference in New Issue
Block a user