comparison gcc/testsuite/g++.dg/cpp2a/range-for5.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 // P0614R1
2 // { dg-do compile }
3 // { dg-options "-std=c++2a" }
4
5 void
6 fn1 ()
7 {
8 int a[] = { 1, 2, 3, 4, 5 };
9
10 for (int i = 0; auto x : a)
11 ++i;
12
13 i = 0; // { dg-error "not declared" }
14
15 for (int i = 0; auto x : a)
16 {
17 for (int j = 0; auto x : a)
18 {
19 for (int k = 0; auto x : a)
20 k++;
21 k++; // { dg-error "not declared" }
22 }
23 j++; // { dg-error "not declared" }
24 }
25 }
26
27 void
28 fn2 ()
29 {
30 int a[] = { 1, 2, 3, 4, 5 };
31 for (int i = 0; auto x : a)
32 int i = 3; // { dg-error "redeclaration" }
33 }
34 void
35 fn3 ()
36 {
37 int a[] = { 1, 2, 3, 4, 5 };
38
39 for (;:) // { dg-error "expected" }
40 {
41 }
42
43 for (;;:) // { dg-error "expected" }
44 {
45 }
46 }