OSDN Git Service

fix
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.other / loop1.C
1 // Test for bad loop optimization of goto fixups.
2 // Special g++ Options: -O2
3
4 typedef bool (*ftype) ();
5
6 int c, d;
7 struct A {
8   A() { ++c; }
9   A(const A&) { ++c; }
10   ~A() { ++d; }
11 };
12
13 void f (ftype func)
14 {
15   A a;
16   do {
17     if ((*func)()) return;
18   } while (true);
19 }
20
21 bool test ()
22 {
23   return true;
24 }
25
26 main ()
27 {
28   f (test);
29   return (c != d);
30 }