Skip to content

Commit bc86b30

Browse files
committed
Add test for #13716
1 parent 7e2283d commit bc86b30

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/testcondition.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3640,6 +3640,15 @@ class TestCondition : public TestFixture {
36403640
"}");
36413641
ASSERT_EQUALS("[test.cpp:2:16] -> [test.cpp:3:9]: (warning) Identical condition 'handle!=nullptr', second condition is always false [identicalConditionAfterEarlyExit]\n", errout_str());
36423642

3643+
check("void f(const char* p) {\n" // #13716
3644+
" if (!p) {}\n"
3645+
" if (p == NULL) {}\n"
3646+
" if (p == nullptr) {}\n"
3647+
" if (p == 0) {}\n"
3648+
"}");
3649+
ASSERT_EQUALS("[test.cpp:2:9] -> [test.cpp:3:11]: (style) The if condition is the same as the previous if condition [duplicateCondition]\n",
3650+
errout_str());
3651+
36433652
check("int f(const char* p) {\n" // #13717
36443653
" if (p) {}\n"
36453654
" else if (!p) {}\n"

0 commit comments

Comments
 (0)