]> git.ipfire.org Git - thirdparty/gcc.git/blob - libvtv/testsuite/dup_name.cc
Commit the vtable verification feature.
[thirdparty/gcc.git] / libvtv / testsuite / dup_name.cc
1 #include <assert.h>
2
3 extern "C" int printf(const char *, ...);
4
5 class Subscriptor
6 {
7 public:
8
9 Subscriptor()
10 { counter = 1;}
11
12 virtual ~Subscriptor()
13 {
14 counter--;
15 assert(counter == 0);
16 }
17
18 private:
19 static int counter;
20 };
21
22 int Subscriptor::counter;
23
24 template <typename number>
25 class Polynomial : public Subscriptor
26 {
27 };
28
29 class LagrangeEquidistant: public Polynomial<double>
30 {
31 };
32
33 template <int value>
34 class A
35 {
36 public:
37 class Nested: public LagrangeEquidistant
38 {
39 };
40 A() { n = new Nested; }
41 ~A() { delete n; }
42 Subscriptor * n;
43 };
44
45 template<typename _Tp>
46 inline void
47 _MyDestroy(_Tp* __pointer)
48 { __pointer->~_Tp(); }
49
50 int main()
51 {
52 Subscriptor * s1 = new LagrangeEquidistant;
53 _MyDestroy(s1);
54 A<1> * a1 = new A<1>;
55 _MyDestroy(a1);
56 A<2> * a2 = new A<2>;
57 _MyDestroy(a2);
58
59 return 0;
60 }