aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/eval-order5.C
blob: a8f06ed421ac0f319ca76c7d2cce7872811a5dad (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
// PR c++/91974
// { dg-do run }
// { dg-options "-fstrong-eval-order" }

extern "C" void abort ();

bool ok = false;

void
foo (int x)
{
  if (x != 0)
    abort ();
  ok = true;
}

void
bar (int)
{
  abort ();
}

int
main ()
{
  typedef void (*T) (int);
  T fn = foo;
  fn ((fn = bar, 0));
  if (fn != bar || !ok)
    abort ();
}