summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-ssa/inline-2.C
blob: 656cba0312c907475886145e30869e21071106a1 (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
29
30
31
32
33
34
35
36
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-einline" } */
/* { dg-add-options bind_pic_locally } */

namespace std {
  extern "C" void puts(const char *s);
}

template <class T, class E> void
foreach (T b, T e, E ptr)
{
  for (; b != e; b++)
    ptr(*b);
}

void
inline_me (char *x)
{
  std::puts(x);
}

static void
inline_me_too (char *x)
{
  std::puts(x);
}

int main(int argc, char **argv)
{
  foreach (argv, argv + argc, inline_me);
  foreach (argv, argv + argc, inline_me_too);
}

/* { dg-final { scan-tree-dump-times "Inlining void inline_me\\(" 1 "einline"} } */
/* { dg-final { scan-tree-dump-times "Inlining void inline_me_too\\(" 1 "einline"} } */
/* { dg-final { cleanup-tree-dump "einline" } } */