diff options
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp b/clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp index 400714b44d9..b46e52a754b 100644 --- a/clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp @@ -59,6 +59,16 @@ void f() { } else { c2 = c; } + struct A { + void foo() { + if (mp) // #6 + delete mp; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer] + // CHECK-FIXES: {{^ }}// #6 + // CHECK-FIXES-NEXT: delete mp; + } + int *mp; + }; } void g() { |