We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dcee438 commit d6b44d9Copy full SHA for d6b44d9
1 file changed
test/testcondition.cpp
@@ -2682,6 +2682,12 @@ class TestCondition : public TestFixture {
2682
check("void f1(const std::string &s) { if(s.empty()) if(42 < s.size()) {}}");
2683
ASSERT_EQUALS("[test.cpp:1:43] -> [test.cpp:1:53]: (warning) Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition]\n", errout_str());
2684
2685
+ check("void f(const std::string& s, int n) {\n" // #14716
2686
+ " if (s.size() < n)\n"
2687
+ " if (s.empty()) {}\n"
2688
+ "}");
2689
+ ASSERT_EQUALS("", errout_str());
2690
+
2691
// TODO: These are identical condition since size cannot be negative
2692
check("void f1(const std::string &s) { if(s.size() <= 0) if(s.empty()) {}}");
2693
ASSERT_EQUALS("", errout_str());
0 commit comments