summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-ssa/pr17517.C
blob: bcd5e91dbae880fbb48936b9a58e0377d129f682 (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
25
26
27
28
29
30
31
32
// Test PR 17517.  Test case provided by Serge Belyshev.
 
 /* { dg-do compile } */
 /* { dg-options "-O2" } */


extern void foo ();

struct Ptr {
  int * ptr;
  Ptr () { ptr = 0; }
  ~Ptr() { delete ptr; }
  Ptr &operator= (int * p) { ptr = p; return *this; }
};

int *new_checker () { foo (); return 0; }

void pipe (int c)
{
  Ptr checker;
  
  foo ();
  for (;;)
    {
    switch (c)
      {
    case '-':
      checker = new_checker ();
      break;
      }
    }
}