Fix gcc.c-torture/execute/ieee/cdivchkf.c on hpux
[official-gcc.git] / libvtv / testsuite / libvtv.cc / dup_name.cc
blobd9d02512630da10ea6e7ca14dd8df691c367ca0e
1 // { dg-do run }
3 #include <assert.h>
5 extern "C" int printf(const char *, ...);
7 class Subscriptor
9 public:
11 Subscriptor()
12 { counter = 1;}
14 virtual ~Subscriptor()
16 counter--;
17 assert(counter == 0);
20 private:
21 static int counter;
24 int Subscriptor::counter;
26 template <typename number>
27 class Polynomial : public Subscriptor
31 class LagrangeEquidistant: public Polynomial<double>
35 template <int value>
36 class A
38 public:
39 class Nested: public LagrangeEquidistant
42 A() { n = new Nested; }
43 ~A() { delete n; }
44 Subscriptor * n;
47 template<typename _Tp>
48 inline void
49 _MyDestroy(_Tp* __pointer)
50 { __pointer->~_Tp(); }
52 int main()
54 Subscriptor * s1 = new LagrangeEquidistant;
55 _MyDestroy(s1);
56 A<1> * a1 = new A<1>;
57 _MyDestroy(a1);
58 A<2> * a2 = new A<2>;
59 _MyDestroy(a2);
61 return 0;