repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
diagnostics: remove duplicate copies of diagnostic_kind_text
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp1z
/
range-for1.C
blob
4bca986d3b55a8eb69685f92a36ccce42e4a4677
1
// P0184R0: Generalizing the Range-Based For Loop
2
// { dg-do compile { target c++17 } }
3
4
struct A {
5
int ar[4];
6
int *begin() { return ar; }
7
struct end_t {
8
int *p;
9
friend bool operator!= (int *p, end_t e) { return p != e.p; }
10
};
11
end_t end() { return { &ar[4] }; }
12
};
13
14
int main()
15
{
16
A a { 1, 2, 3, 4 };
17
int i = 1;
18
for (auto x: a)
19
if (x != i++)
20
__builtin_abort ();
21
if (i != 5)
22
__builtin_abort ();
23
}