gcc/testsuite/g++.dg/torture/pr40102.C
raw| 1 | /* { dg-do compile } */ |
| 2 | bool foo0(int) { return true; } |
| 3 | |
| 4 | bool foo1(); |
| 5 | |
| 6 | struct A |
| 7 | { |
| 8 | A(); |
| 9 | ~A(); |
| 10 | |
| 11 | template<typename T> void bar1(T f) |
| 12 | { |
| 13 | if (f(0)) |
| 14 | foo1(); |
| 15 | } |
| 16 | |
| 17 | template<typename T> void bar2(T); |
| 18 | }; |
| 19 | |
| 20 | template<typename T> void A::bar2(T f) |
| 21 | { |
| 22 | A a, b[1], *p; |
| 23 | |
| 24 | while (foo1()) |
| 25 | { |
| 26 | if (p) |
| 27 | ++p; |
| 28 | if (p && foo1()) |
| 29 | bar1(f); |
| 30 | if (p) |
| 31 | ++p; |
| 32 | } |
| 33 | |
| 34 | if (foo1()) |
| 35 | bar1(f); |
| 36 | } |
| 37 | |
| 38 | void baz() |
| 39 | { |
| 40 | A().bar2(foo0); |
| 41 | } |