xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/cxx-for-range.h (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Header for PCH test cxx-for-range.cpp
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct S {
4*f4a2713aSLionel Sambuc   int *begin();
5*f4a2713aSLionel Sambuc   int *end();
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc struct T { };
9*f4a2713aSLionel Sambuc char *begin(T);
10*f4a2713aSLionel Sambuc char *end(T);
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc namespace NS {
13*f4a2713aSLionel Sambuc   struct U { };
14*f4a2713aSLionel Sambuc   char *begin(U);
15*f4a2713aSLionel Sambuc   char *end(U);
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc using NS::U;
18*f4a2713aSLionel Sambuc 
f()19*f4a2713aSLionel Sambuc void f() {
20*f4a2713aSLionel Sambuc   char a[3] = { 0, 1, 2 };
21*f4a2713aSLionel Sambuc   for (auto w : a)
22*f4a2713aSLionel Sambuc     for (auto x : S())
23*f4a2713aSLionel Sambuc       for (auto y : T())
24*f4a2713aSLionel Sambuc         for (auto z : U())
25*f4a2713aSLionel Sambuc           ;
26*f4a2713aSLionel Sambuc }
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc template<typename A>
g()29*f4a2713aSLionel Sambuc void g() {
30*f4a2713aSLionel Sambuc   A a[3] = { 0, 1, 2 };
31*f4a2713aSLionel Sambuc   for (auto &v : a)
32*f4a2713aSLionel Sambuc     for (auto x : S())
33*f4a2713aSLionel Sambuc       for (auto y : T())
34*f4a2713aSLionel Sambuc         for (auto z : U())
35*f4a2713aSLionel Sambuc           ;
36*f4a2713aSLionel Sambuc }
37