gcc/testsuite/g++.dg/cpp1z/eval-order9.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-additional-options -fstrong-eval-order=all } |
| 3 | |
| 4 | struct A |
| 5 | { |
| 6 | virtual A& operator=(const A&) { return *this; } |
| 7 | }; |
| 8 | |
| 9 | int i; |
| 10 | |
| 11 | A& f() { if (i != 1) __builtin_abort (); i = 2; static A a; return a; } |
| 12 | A& g() { if (i != 0) __builtin_abort (); i = 1; static A a; return a; } |
| 13 | |
| 14 | int main() |
| 15 | { |
| 16 | f() = g(); |
| 17 | if (i != 2) __builtin_abort (); |
| 18 | } |