1 // Test PR 17517. Test case provided by Serge Belyshev. 2 3 /* { dg-do compile } */ 4 /* { dg-options "-O2" } */ 5 6 7 extern void foo (); 8 9 struct Ptr { 10 int * ptr; PtrPtr11 Ptr () { ptr = 0; } ~PtrPtr12 ~Ptr() { delete ptr; } 13 Ptr &operator= (int * p) { ptr = p; return *this; } 14 }; 15 new_checker()16int *new_checker () { foo (); return 0; } 17 pipe(int c)18void pipe (int c) 19 { 20 Ptr checker; 21 22 foo (); 23 for (;;) 24 { 25 switch (c) 26 { 27 case '-': 28 checker = new_checker (); 29 break; 30 } 31 } 32 } 33