gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice25.C
raw| 1 | // PR c++/83204 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | int rand(); |
| 5 | |
| 6 | template<typename T> |
| 7 | struct s |
| 8 | { |
| 9 | int count() { return rand(); } |
| 10 | }; |
| 11 | |
| 12 | template<typename v> |
| 13 | void f(s<v> a) |
| 14 | { |
| 15 | int const x = a.count(); |
| 16 | int r = 0; |
| 17 | auto l = [&](int& r) |
| 18 | { |
| 19 | for(int y = 0, yend = (x); y < yend; ++y) |
| 20 | { |
| 21 | r += y; |
| 22 | } |
| 23 | }; |
| 24 | l(r); |
| 25 | } |
| 26 | |
| 27 | template void f(s<float>); |