gcc/testsuite/g++.dg/cpp0x/lambda/lambda-typedef.C
raw| 1 | // PR c++/54975 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<typename T> |
| 5 | struct identity |
| 6 | { |
| 7 | typedef T type; |
| 8 | }; |
| 9 | |
| 10 | template<typename T> |
| 11 | void f() |
| 12 | { |
| 13 | typedef typename T::type A; |
| 14 | int i = 42; |
| 15 | int const &cri = i; |
| 16 | int volatile &vri = i; |
| 17 | [&]() { |
| 18 | A const &x = cri; // Problem here |
| 19 | A volatile &y = vri; // Likewise |
| 20 | }; |
| 21 | } |
| 22 | |
| 23 | int main() |
| 24 | { |
| 25 | f<identity<int> >(); |
| 26 | } |