PR c++/81917 - ICE with void_t and partial specialization.
[official-gcc.git] / gcc / testsuite / g++.dg / opt / flifetime-dse2.C
blob16d9a7487819f73ea63d8c039af39650857119c5
1 // { dg-options "-O3 -flifetime-dse" }
2 // { dg-do run }
4 typedef __SIZE_TYPE__ size_t;
5 inline void * operator new (size_t, void *p) { return p; }
7 struct A
9   int i;
10   A() {}
11   ~A() {}
14 int main()
16   int ar[1] = { 42 };
17   A* ap = new(ar) A;
19   // When the constructor starts the object has indeterminate value.
20   if (ap->i == 42) __builtin_abort();
22   ap->i = 42;
23   ap->~A();
25   // When the destructor ends the object no longer exists.
26   if (ar[0] == 42) __builtin_abort();