comparison gcc/testsuite/g++.dg/cpp2a/range-for12.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // PR c++/87152
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 template<typename T>
16 void
17 fn1 (T i)
18 {
19 for ((i += 2); auto x : a)
20 foo (i);
21
22 for (auto j = 0, k = 0; auto x : a)
23 bar (j + k, x);
24
25 for (constexpr int j = baz (); auto x : a)
26 bar (x, j);
27 }
28
29 void
30 do_fn1 ()
31 {
32 fn1<int>(10);
33 }