gcc/testsuite/g++.old-deja/g++.other/crash22.C
raw| 1 | // { dg-do link } |
| 2 | // { dg-options "-O2" } |
| 3 | |
| 4 | class foo |
| 5 | { |
| 6 | }; |
| 7 | |
| 8 | typedef void *voidp; |
| 9 | class vect : public foo |
| 10 | { |
| 11 | public: |
| 12 | voidp& a(); |
| 13 | int b(); |
| 14 | }; |
| 15 | |
| 16 | class bar |
| 17 | { |
| 18 | public: |
| 19 | bar *c(bool (*f)(bar *node), voidp g) |
| 20 | { |
| 21 | int i=0; |
| 22 | bool j; |
| 23 | while (i < d.b()){ |
| 24 | j = (f == __null) || f((bar*)d.a()); |
| 25 | if (j) |
| 26 | ((bar*)d.a())->c(f, g); |
| 27 | i++; |
| 28 | } |
| 29 | return this; |
| 30 | } |
| 31 | public: |
| 32 | vect d; |
| 33 | bar *e(foo *k); |
| 34 | }; |
| 35 | |
| 36 | bar *bar::e(foo *k) |
| 37 | { |
| 38 | return c(__null, k); |
| 39 | } |
| 40 | |
| 41 | voidp &vect::a() |
| 42 | { |
| 43 | static voidp x; |
| 44 | return x; |
| 45 | } |
| 46 | |
| 47 | int vect::b() |
| 48 | { |
| 49 | static int x; |
| 50 | return x; |
| 51 | } |
| 52 | |
| 53 | int main() |
| 54 | { |
| 55 | return 0; |
| 56 | } |