summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/useuniqueptr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/test/useuniqueptr.cxx')
-rw-r--r--compilerplugins/clang/test/useuniqueptr.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/useuniqueptr.cxx b/compilerplugins/clang/test/useuniqueptr.cxx
index ef0dde3cf538..a68cea3201d0 100644
--- a/compilerplugins/clang/test/useuniqueptr.cxx
+++ b/compilerplugins/clang/test/useuniqueptr.cxx
@@ -151,4 +151,15 @@ class Foo12 {
delete m_pbar[i++]; // expected-error {{rather manage with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}}
}
};
+#define DELETEZ( p ) ( delete p,p = NULL )
+class Foo13 {
+ int * m_pbar1; // expected-note {{member is here [loplugin:useuniqueptr]}}
+ int * m_pbar2; // expected-note {{member is here [loplugin:useuniqueptr]}}
+ ~Foo13()
+ {
+ if (m_pbar1)
+ DELETEZ(m_pbar1); // expected-error {{unconditional call to delete on a member, should be using std::unique_ptr [loplugin:useuniqueptr]}}
+ DELETEZ(m_pbar2); // expected-error {{unconditional call to delete on a member, should be using std::unique_ptr [loplugin:useuniqueptr]}}
+ }
+};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */