diff options
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r-- | compilerplugins/clang/refcounting.cxx | 3 | ||||
-rw-r--r-- | compilerplugins/clang/test/refcounting.cxx | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index fa026877680b..f15e423aebd2 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -211,6 +211,9 @@ bool containsOWeakObjectSubclass(const QualType& qType) { bool containsOWeakObjectSubclass(const clang::Type* pType0) { if (!pType0) return false; + if (pType0->isDependentType()) { + return false; + } const clang::Type* pType = pType0->getUnqualifiedDesugaredType(); if (!pType) return false; diff --git a/compilerplugins/clang/test/refcounting.cxx b/compilerplugins/clang/test/refcounting.cxx index 69825e6fc47b..8a1f277829cc 100644 --- a/compilerplugins/clang/test/refcounting.cxx +++ b/compilerplugins/clang/test/refcounting.cxx @@ -57,4 +57,19 @@ void test2(UnoObject* pUnoObject) delete pUnoObject; } +template <typename T> struct Dependent : T +{ + void f() { delete this; } + //TODO: missing expected error@+1 {{cppu::OWeakObject subclass 'Dependent<UnoObject>' being deleted via delete, should be managed via rtl::Reference [loplugin:refcounting]}} + void g() { delete this; } +}; +struct Dummy +{ +}; +void dummy(Dependent<Dummy>* p1, Dependent<UnoObject>* p2) +{ + p1->f(); + p2->g(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |