You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testcondition.cpp
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6472,6 +6472,19 @@ class TestCondition : public TestFixture {
6472
6472
" if (INT_MAX > ll * 8) {}\n"
6473
6473
"}\n");
6474
6474
ASSERT_EQUALS("", errout_str());
6475
+
6476
+
check("bool f(int a, int b) {\n" / #12896
6477
+
" if (a < INT_MIN && b > INT_MAX)\n"
6478
+
" return true;\n"
6479
+
" return false;\n"
6480
+
"}\n"
6481
+
"bool g(int x) {\n"// #6796
6482
+
" return (x > INT_MAX) ? true : false;\n"
6483
+
"}\n");
6484
+
ASSERT_EQUALS("[test.cpp:2:13]: (style) Comparing expression of type 'signed int' against value -2147483648. Condition is always false. [compareValueOutOfTypeRangeError]\n"
6485
+
"[test.cpp:2:28]: (style) Comparing expression of type 'signed int' against value 2147483647. Condition is always false. [compareValueOutOfTypeRangeError]\n"
6486
+
"[test.cpp:7:17]: (style) Comparing expression of type 'signed int' against value 2147483647. Condition is always false. [compareValueOutOfTypeRangeError]\n",
0 commit comments