Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp2a/range-for17.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
rev | line source |
---|---|
131 | 1 // PR c++/87152 |
2 // { dg-do run } | |
3 // { dg-options "-std=c++2a" } | |
4 | |
5 struct A { int i; long long j; } a[64]; | |
6 | |
7 template<typename> | |
8 void foo () | |
9 { | |
10 A b = { 1, 2 }; | |
11 for (auto & [ u, v ] : a) | |
12 { | |
13 u = 2; | |
14 v = 3; | |
15 } | |
16 | |
17 for (auto [x, y] = b; auto [ u, v ] : a) | |
18 if (y + u != x + v) | |
19 __builtin_abort (); | |
20 | |
21 for (auto [x, y] = b; auto & [ u, v ] : a) | |
22 if (y + u != x + v) | |
23 __builtin_abort (); | |
24 } | |
25 | |
26 int | |
27 main () | |
28 { | |
29 foo<int>(); | |
30 } |