1 // Test for errors in range-based for loops
2 // with member begin/end
4 // { dg-do compile { target c++11 } }
21 int *begin(); // { dg-message "private" }
22 int *end(); // { dg-message "private" }
50 static callable begin;
60 struct private_callable
63 int *operator()(); // { dg-message "private" }
68 private_callable begin;
74 typedef int *(*function)();
82 template<typename T> int *begin(T &t)
86 template<typename T> int *end(T &t)
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());