aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr64191.C
blob: da09a7752e75db108b51cb49f2a1ef4c58c0e80e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// { dg-do compile }
// { dg-options "-O2 -fdump-tree-cddce1" }

struct Bar
{
  int i;
  ~Bar() { }
};
void bar_dtor_loop(Bar* p, unsigned int n)
{
  if (p) {
      Bar* e = p + n;
      while (e > p) {
	  --e;
	  e->~Bar();
      }
  }
}

// The clobber in ~Bar should persist but those inlined into
// bar_dtor_loop not, nor should the loop therein

// { dg-final { scan-tree-dump-times "CLOBBER" 1 "cddce1" } }
// { dg-final { scan-tree-dump-times "if" 0 "cddce1" } }