* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / range-for15.C
blob5dd442dd1d5534b0fda386123c509c7bdcc43ea5
1 // Test for range-based for loop with templates
2 // and begin/end as member (non-)virtual functions
4 // { dg-do run { target c++11 } }
6 unsigned int g;
8 struct A
10     virtual int *begin()
11     {
12         g |= 1;
13         return 0;
14     }
15     int *end()
16     {
17         g |= 2;
18         return 0;
19     }
22 struct B : A
24     virtual int *begin()
25     {
26         g |= 4;
27         return 0;
28     }
29     int *end()
30     {
31         g |= 8;
32         return 0;
33     }
36 extern "C" void abort(void);
38 int main ()
40     A a;
41     B b;
42     A &aa = b;
44     g = 0;
45     for (int x : a);
46     if (g != (1 | 2))
47         abort();
49     g = 0;
50     for (int x : b);
51     if (g != (4 | 8))
52         abort();
54     g = 0;
55     for (int x : aa);
56     if (g != (4 | 2))
57         abort();