blob: a9d279af74eeb7f1e3ef3293ade5bd523f509ea5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-fre-details" } */
int f();
template<typename predicate>
class noop_t {
const predicate &pred;
public:
explicit noop_t(const predicate &p) : pred(p) {}
int operator()() const { return pred(); }
};
template<typename predicate>
inline noop_t<predicate> noop(const predicate pred) {
return noop_t<predicate>(pred);
}
int x()
{
return (noop(noop(noop(noop(noop(noop(noop(noop(noop(f)))))))))());
}
/* We should optimize this to a direct call. */
/* { dg-final { scan-tree-dump "Replacing call target with f" "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
|