gcc/testsuite/g++.dg/tree-ssa/pr40874.C
raw| 1 | // { dg-do compile } |
| 2 | // { dg-options "-O -fdump-tree-optimized" } |
| 3 | |
| 4 | struct pf |
| 5 | { |
| 6 | inline pf(int(*x)(int)) : x(x) {} |
| 7 | |
| 8 | inline int operator()(int a) const |
| 9 | { |
| 10 | return x(a); |
| 11 | } |
| 12 | |
| 13 | int (*x)(int); |
| 14 | }; |
| 15 | |
| 16 | inline int g(int x) { return x/x - 1; } |
| 17 | |
| 18 | int main(int argc, char* argv[]) |
| 19 | { |
| 20 | pf f(g); |
| 21 | return f(3); |
| 22 | } |
| 23 | |
| 24 | // { dg-final { scan-tree-dump "return 0" "optimized" } } |