gcc/testsuite/g++.dg/cpp2a/range-for3.C
raw| 1 | // P0614R1 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-std=c++2a" } |
| 4 | |
| 5 | static const int a[] = { 1, 2, 3, 4, 5 }; |
| 6 | extern void foo (int); |
| 7 | extern void bar (int, int); |
| 8 | |
| 9 | constexpr int |
| 10 | baz () |
| 11 | { |
| 12 | return 6; |
| 13 | } |
| 14 | |
| 15 | void |
| 16 | fn1 (int i) |
| 17 | { |
| 18 | for ((i += 2); auto x : a) |
| 19 | foo (i); |
| 20 | |
| 21 | for (auto j = 0, k = 0; auto x : a) |
| 22 | bar (j + k, x); |
| 23 | |
| 24 | for (constexpr int j = baz (); auto x : a) |
| 25 | bar (x, j); |
| 26 | } |