Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.old-deja / g++.jason / dtor5.C
blob3cf1d1cd0e2763cb863a39f31d25200fc3262cd3
1 // { dg-do run  }
2 // PRMS Id: 5286
3 // Bug: g++ forgets side-effects of object in call to nonexistent destructor.
5 #include <new>
7 int r;
9 template <class T> struct A {
10   T *p;
11   int i;
12   A() { i = 0; p = (T*) new char[sizeof (T)]; new (p + i++) T; }
13   ~A() { p[--i].~T(); r = i; }
16 int main()
18   { A<int> a; }
20   int* p = (int*) new char[sizeof (int)];
21   new (p + r++) int;
22   typedef int I;
23   p[--r].~I();
24   
25   return r;