* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / range-for13.C
blob7babd713cfbbbb1411b0db9bff1a0f0464655f02
1 // Test for errors in range-based for loops
2 // with member begin/end
4 // { dg-do compile { target c++11 } }
6 struct container1
8     int *begin();
9     //no end
12 struct container2
14     int *end();
15     //no begin
18 struct container3
20 private:
21     int *begin(); // { dg-message "private" }
22     int *end(); // { dg-message "private" }
25 struct container4
27     int *begin;
28     int *end;
31 struct container5
33     typedef int *begin;
34     typedef int *end;
37 struct callable
39     int *operator()();
42 struct container6
44     callable begin;
45     callable end;
48 struct container7
50     static callable begin;
51     static callable end;
54 struct container8
56     static int *begin();
57     int *end();
60 struct private_callable
62 private:
63     int *operator()(); // { dg-message "private" }
66 struct container9
68     private_callable begin;
69     private_callable end;
72 struct container10
74     typedef int *(*function)();
76     function begin;
77     static function end;
80 namespace N
82 template<typename T> int *begin(T &t)
84     return 0;
86 template<typename T> int *end(T &t)
88     return 0;
90 struct container11
92     int *begin();
93     //no end
96 struct container12
98     int *end();
99     //no begin
102 struct container13
107 void test1()
109   for (int x : container1()); // { dg-error "'begin' was not declared|'end' was not declared" }
110   for (int x : container2()); // { dg-error "'begin' was not declared|'end' was not declared" }
111   for (int x : container3()); // { dg-error "within this context" }
112   for (int x : container4()); // { dg-error "cannot be used as a function" }
113   for (int x : container5()); // { dg-error "invalid use of" }
114   for (int x : container6());
115   for (int x : container7());
116   for (int x : container8());
117   for (int x : container9()); // { dg-error "within this context" }
118   for (int x : container10());
119   for (int x : N::container11());
120   for (int x : N::container12());
121   for (int x : N::container13());