gcc/testsuite/g++.dg/cpp0x/range-for37.C
raw| 1 | // PR c++/89217 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct R {}; |
| 5 | |
| 6 | struct C |
| 7 | { |
| 8 | R* begin() const { return &r; } |
| 9 | R* end() const { return &r; } |
| 10 | |
| 11 | R& r; |
| 12 | }; |
| 13 | |
| 14 | struct S |
| 15 | { |
| 16 | void f1() { f2<true>(); } |
| 17 | R& r; |
| 18 | |
| 19 | template<bool> |
| 20 | void f2() |
| 21 | { |
| 22 | for (auto i : C{r}) {} |
| 23 | } |
| 24 | }; |