view gcc/testsuite/g++.dg/cpp1z/eval-order9.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

// { 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 ();
}