summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr40102.C
blob: 49f56b5bc5a319bce974e947355a6d3704013f21 (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
41
/* { dg-do compile } */
bool foo0(int) { return true; }

bool foo1();

struct A
{
  A();
  ~A();

  template<typename T> void bar1(T f)
  {
    if (f(0))
      foo1();
  }

  template<typename T> void bar2(T);
};

template<typename T> void A::bar2(T f)
{
  A a, b[1], *p;

  while (foo1())
  {
    if (p)
      ++p;
    if (p && foo1())
      bar1(f);
    if (p)
      ++p;
  }

  if (foo1())
    bar1(f);
}

void baz()
{
  A().bar2(foo0);
}