C++: Add false positive.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-12-14 16:38:19 +00:00
parent b49ca6a24c
commit 9d14a85f3f
2 changed files with 20 additions and 0 deletions

View File

@@ -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. |

View File

@@ -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>();
}