aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gcov/gcov-17.C
blob: d11883cfd397290a4145799b69139310e5f9a809 (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
37
38
39
40
/* { dg-options "--coverage -std=c++11" } */
/* { dg-do run { target native } } */

template <class T> class Foo
{
public:
  Foo () : b (1000) {}

  void inc () { b++; }

private:
  int b;
};

template class Foo<int>;
template class Foo<char>;

int
main (void)
{
  int i, total;
  Foo<int> counter;

  counter.inc ();
  counter.inc ();
  total = 0;

  for (i = 0; i < 10; i++)
    total += i;

  int v = total > 100 ? 1 : 2;

  if (total != 45)
    __builtin_printf ("Failure\n");
  else
    __builtin_printf ("Success\n");
  return 0;
}

/* { dg-final { run-gcov-pytest gcov-17.C "test-gcov-17.py" } } */