Skip to content

Commit d6b44d9

Browse files
Update testcondition.cpp
1 parent dcee438 commit d6b44d9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/testcondition.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,12 @@ class TestCondition : public TestFixture {
26822682
check("void f1(const std::string &s) { if(s.empty()) if(42 < s.size()) {}}");
26832683
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());
26842684

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+
26852691
// TODO: These are identical condition since size cannot be negative
26862692
check("void f1(const std::string &s) { if(s.size() <= 0) if(s.empty()) {}}");
26872693
ASSERT_EQUALS("", errout_str());

0 commit comments

Comments
 (0)