Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / Checkers / WebKit / ref-cntbl-base-virtual-dtor-templates.cpp
blob3338fa9368e4b5a3d49157b5e36500385360072f
1 // RUN: %clang_analyze_cc1 -analyzer-checker=webkit.RefCntblBaseVirtualDtor -verify %s
3 struct RefCntblBase {
4 void ref() {}
5 void deref() {}
6 };
8 template<class T>
9 struct DerivedClassTmpl1 : T { };
10 // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedClassTmpl1<RefCntblBase>' but doesn't have virtual destructor}}
12 DerivedClassTmpl1<RefCntblBase> a;
16 template<class T>
17 struct DerivedClassTmpl2 : T { };
18 // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedClassTmpl2<RefCntblBase>' but doesn't have virtual destructor}}
20 template<class T> int foo(T) { DerivedClassTmpl2<T> f; return 42; }
21 int b = foo(RefCntblBase{});
25 template<class T>
26 struct DerivedClassTmpl3 : T { };
27 // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedClassTmpl3<RefCntblBase>' but doesn't have virtual destructor}}
29 typedef DerivedClassTmpl3<RefCntblBase> Foo;
30 Foo c;