1 // Test for other range-based for loops with
2 // begin/end member functions
4 // { dg-do compile { target c++11 } }
6 //These should not be used
7 template<typename T> int *begin(T &t)
11 template<typename T> int *end(T &t)
20 int *begin(int x); // { dg-message "note" }
32 template <typename T> T *begin(); // { dg-message "note" }
38 template <typename T=int> T *begin();
44 template <typename T=int> T *begin(int x=0);
50 for (int x : default1()); // { dg-error "no matching function|note" }
51 for (int x : default2());
52 for (int x : default3()); // { dg-error "no matching function|note" }
53 for (int x : default4());
54 for (int x : default5());
61 int *begin(); // { dg-message "" }
69 struct derived1 : base_begin, base_end
73 struct base_begin2 : base_begin
77 struct derived2 : base_begin, base_end, base_begin2 // { dg-warning "" }
81 struct base_begin3 : virtual base_begin
85 struct derived3 : virtual base_begin, base_end, base_begin3
91 for (int x : derived1());
92 for (int x : derived2()); // { dg-error "is ambiguous" }
93 for (int x : derived3());