1 // PR c++/89217
2 // { dg-do compile { target c++11 } }
3 
4 struct R {};
5 
6 struct C
7 {
beginC8     R* begin() const { return &r; }
endC9     R* end() const { return &r; }
10 
11     R& r;
12 };
13 
14 struct S
15 {
f1S16     void f1() { f2<true>(); }
17     R& r;
18 
19     template<bool>
f2S20     void f2()
21     {
22         for (auto i : C{r}) {}
23     }
24 };
25