aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/eval-order9.C
blob: 7001f5a7b52e3f7e68c6bfae82f57315f10024a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// { dg-do run }
// { dg-additional-options -fstrong-eval-order=all }

struct A
{
  virtual A& operator=(const A&) { return *this; }
};

int i;

A& f() { if (i != 1) __builtin_abort (); i = 2; static A a; return a; }
A& g() { if (i != 0) __builtin_abort (); i = 1; static A a; return a; }

int main()
{
  f() = g();
  if (i != 2) __builtin_abort ();
}